This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/52788] New: -fbounds-check fails for 2-rank allocatable arrays when reading


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

             Bug #: 52788
           Summary: -fbounds-check fails for 2-rank allocatable arrays
                    when reading
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: Edouard.Canot@irisa.fr


For the following code:

================================
program test1

   implicit none

   double precision, allocatable :: C(:,:)
   integer :: i

   allocate( C(3,2) )
   open(10,file='C.dat')
   do i = 1, 4
      read(10,*) C(i,:) ! fbounds-check doesn't work
   end do
   close(10)

end program
================================

gfortran doesn't catch at run-time the last data read using the first dimension
i=4

The data file 'C.dat' is not important, I have used:
$ cat C.dat
1.0 -1.0
2.0 -2.0
3.0 -3.0
4.0 -4.0

but it can contains any numerical data spread over two columns.


---
The previous code has been compiled with:

$ gfortran -fbounds-check -o test1 test1.f90

The failure occurs at least for the following version of gcc:
4.3.6, 4.4.7, 4.5.3, 4.6.3, 4.7.0
i.e. all known versions from 4.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]