Reduced test case from forall_13.f90: $ cat f1.f90 integer :: p(4)
p = (/3,1,4,2/) forall (i = 1:4) p(5 - p(i)) = p(5 - i) if (any (p .ne. (/1,2,3,4/))) call abort () end $ gfortran -fbounds-check f1.f90 $ ./a.out At line 5 of file f1.f90 Fortran runtime error: Array reference out of bounds for array 'p', upper bound of dimension 1 exceeded (4 > 3) $ gfortran -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../../gcc/trunk/configure --prefix=/home/ig25 --enable-maintainer-mode --enable-languages=c,fortran Thread model: posix gcc version 4.4.0 20080420 (experimental) (GCC) -- Summary: false positive in bounds checking with forall Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tkoenig at gcc dot gnu dot org OtherBugsDependingO 27766 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36091