The following programme

program checkarrsize
  implicit none
  double precision a(10,10)
  call sub (a)
contains
  subroutine sub(a)
    double precision a(*)
    a(20) = 0
  end subroutine sub
end program checkarrsize

passes a two-dimensional array to a subroutine that expects a one-dimensional
assumed size array.  When I compile this with

$ ~/gcc/bin/gfortran --version
GNU Fortran 95 (GCC) 4.2.0 20060329 (experimental)

$ ~/gcc/bin/gfortran -fbounds-check -o checkarrsize checkarrsize.f90 

and run it, then I receive the run-time error message

$ ./checkarrsize 
Fortran runtime error: Array reference out of bounds


-- 
           Summary: -fbounds-check is too strict for assumed size arrays
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schnetter at aei dot mpg dot de
 GCC build triplet: i386-apple-darwin8.5.2
  GCC host triplet: i386-apple-darwin8.5.2
GCC target triplet: i386-apple-darwin8.5.2


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

Reply via email to