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

markeggleston at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markeggleston at gcc dot 
gnu.org

--- Comment #8 from markeggleston at gcc dot gnu.org ---
trunk (10.0 svn revision 280100)

Current state of play:

For arrays allocated at compile time bounds checking works at compile time:

program test
integer, dimension(10,10) :: x
print *, x(0,:)
end program test

$ gfortran -fbounds-check pr30802.f90


    7 | print *, x(0,:)
      |           1
Warning: Array reference at (1) is out of bounds (0 < 1) in dimension 1

Changing to allocated arrays and bounds checking does not work at compile time
but does at runtime:

program test
real, allocatable :: x(:)
allocate(x(10))
x = 0.0
print *, x(0)
deallocate(x)
end program test

$ gfortran -fbounds-check pr30802.f90
$ ./a.out

At line 5 of file pr30802.f90
Fortran runtime error: Index '0' of dimension 1 of array 'x' below lower bound
of 1

Error termination. Backtrace:
#0  0x400ea1 in ???
#1  0x400f6d in ???
#2  0x4380b2 in ???
#3  0x438471 in ???
#4  0x400c69 in ???

Reply via email to