https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68546
Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tkoenig at gcc dot gnu.org Depends on| |64773 --- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- We're missing an internal_pack here. This works, as expected: module x contains subroutine foo(A_sect) real :: A_sect(:) write(*, '(3(1x,f5.1))') A_sect(:) end subroutine foo end module x program assoc use x integer :: i, j real :: A(3,3) do j = 1, 3 do i = 1, 3 A(i,j) = 100.0*i + j end do end do write(*,'(a)') 'write statement with fixed i section' write(*, '(3(1x,f5.1))') A(2,:) write(*,'(a)') '----------' write(*,'(a)') 'calling foo with fixed i section' call foo(A(2,:)) write(*,'(a)') '----------' write(*,'(a)') 'write statement with associated fixed i section' associate( A2 => A(2,:) ) write(*, '(3(1x,f5.1))') A2 end associate write(*,'(a)') '----------' write(*,'(a)') 'calling foo with associated fixed i section' associate( A2 => A(2,:) ) call foo(A2) end associate write(*,'(a)') '----------' end program assoc Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64773 [Bug 64773] [F2008] Not packing arrays with changing variable used for size in block