[Bug fortran/19777] -fbounds-check catches non-existent bounds violation

anlauf at gmx dot de gcc-bugzilla@gcc.gnu.org
Fri Feb 17 23:04:00 GMT 2006



------- Comment #9 from anlauf at gmx dot de  2006-02-17 23:04 -------
(In reply to comment #8)
[...]
> does not trigger the Array out-of-bounds-condition any more in our code.
> Therefore we are glad to have this fix!
> 
> Tested on gcc-4.1-20060210 x86_64-unknown-linux-gnu

Negative.  The following valid code still fails on i386: 

% gfc gfcbug31.f -Wall -O0 -g -fbounds-check && ./a.out
 In init1: npts =           1
 i =           1
Fortran runtime error: Array reference out of bounds
% cat gfcbug31.f
      program gfcbug31
      implicit none
      integer          npts
      parameter        (npts=1)
      double precision v(npts)
      external         init1

      call init1 (npts, v)
      end

      subroutine init1 (npts, v)
      implicit none
      integer          npts
c Assumed size arrays don't work together with -fbounds-check
      double precision v(*)
c      double precision v(npts)

      integer          i

      print *, "In init1: npts =", npts
      do 10 i = 1, npts
         print *, "i =", i
         v(i) = 0
         print *, "Got here!"
 10   continue
      print *, "done."
      end


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19777



More information about the Gcc-bugs mailing list