[Bug fortran/64773] [F2008] Not packing arrays with changing variable used for size in block

tkoenig at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 26 07:56:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64773

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I just realized that gfortran actually does the Right Thing here.

We pass the array to baz using seqence association, so the first 16
elements of a are set to one.  This is what is supposed to happen.

When we use

program main
  integer :: n
  n = 5
  block
    integer, dimension(n, n) :: a
    a = 0
    n = n - 1
    call baz(a)
    print '(5I2)',a
  end block
contains
  subroutine baz(a)
    integer, dimension(:,:), intent(inout) :: a
    a = 1
  end subroutine baz
end program main

everything works perfectly.

Resolving as invalid (and grumbling about the pitfalls of sequence
association).


More information about the Gcc-bugs mailing list