------- Comment #7 from kargl at gcc dot gnu dot org 2010-04-16 16:38 -------
Taking the code in comment #1, and changing the initialization to
an assignment.
program fred
implicit none
real :: JTEJ(0:100,0:6000,6)
real :: pT(10000:20000, 6)
JTEJ = 1.0
pT = 2.0
write(*,*) JTEJ(0,1000,:) * pT(1000,:)
end
I get
laptop:kargl[269] gfc4x -o z -fcheck=bounds g.f90 -fdump-tree-original
g.f90:7.31:
write(*,*) JTEJ(0,1000,:) * pT(1000,:)
1
Warning: Array reference at (1) is out of bounds (1000 < 10000) in dimension 1
laptop:kargl[270] ./z
At line 7 of file g.f90
Fortran runtime error: Index '1000' of dimension 1 of array 'pt' outside of
expected range (10000:20000)
First, the warning should be sufficient to tell the programmer that
there is a problem. Second, the runtime error message is correct.
For the code in comment #6, we have
laptop:kargl[272] gfc4x -o z -fcheck=bounds g.f90
g.f90:3.24:
write(*,*) u(1,:) * v(2,:)
1
Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1
laptop:kargl[273] ./z
At line 3 of file g.f90
Fortran runtime error: Index '2' of dimension 1 of array 'v' outside of
expected range (1:1)
Thus, I'm closing this as fixed.
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34546