Hi, the following code dies now with a reported array bounds violation, although it should be correct and used to work.
% cat gfcbug84.f90 module gfcbug84 implicit none contains elemental subroutine tq_tvgh (t, p) real ,intent (out) :: t real ,intent (in) :: p t=p end subroutine tq_tvgh end module gfcbug84 !------------------- program gfcbu84_main use gfcbug84 implicit none integer :: jplev, k_lev real, allocatable :: p(:) type t real, pointer :: av (:,:) end type t type(t) :: var_f jplev = 42 k_lev = 1 allocate (p(jplev)) allocate (var_f% av(jplev,1)) var_f% av = 0 write (0,*) "associated:", associated (var_f% av) write (0,*) "shape :", shape (var_f% av) call tq_tvgh (var_f% av (k_lev:,1), p(k_lev:)) print *, "OK" end program gfcbu84_main % gfc43 gfcbug84.f90 -fbounds-check -O1 -g -fbacktrace % ./a.out associated: T shape : 42 1 At line 28 of file gfcbug84.f90 Fortran runtime error: Array reference out of bounds for array 'var_f', lower bound of dimension 2 exceeded(1 < 4294967296) Backtrace for this error: + function gfcbu84_main (0x4021BD) at line 28 of file gfcbug84.f90 + /lib64/libc.so.6(__libc_start_main+0xe6) [0x2b4825335436] % gfc44 gfcbug84.f90 -fbounds-check -O0 -g -fbacktrace ./a.out associated: T shape : 42 1 At line 28 of file gfcbug84.f90 Fortran runtime error: Array reference out of bounds for array 'var_f', upper bound of dimension 2 exceeded (1 > 0) Backtrace for this error: + function gfcbu84_main (0x4028D1) at line 28 of file gfcbug84.f90 + /lib64/libc.so.6(__libc_start_main+0xe6) [0x2aed6fd0f436] I have tested with Tobias' snapshots. Known to work: gcc-4.3-x86_64-2008-12-21-r142852.tar.gz gcc-trunk-x86_64-2008-12-15-r142760.tar.gz Known to fail: gcc-4.3-x86_64-2008-12-22-r142864.tar.gz gcc-trunk-x86_64-2008-12-16-r142777.tar.gz Cheers, -ha -- Summary: [Regression] Array bounds violation for arguments of elemental subroutine Product: gcc Version: 4.3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: anlauf at gmx dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38669