Note that this seems to be unique to the Tru64 build with gcc-3.3.2 (TWW) It occurs with or without -fbounds-check
OSF1 V5.1 2650 alpha (BUT NOT CYGWIN_NT-5.0 1.5.7(0.109/3/2) 2004-01-30 19:32 i686) GNU Fortran 95 (GCC 4.0.0 20041114 (experimental)) built with gcc-3.3.2 (TWW) Index range, y(start:end) produce runtime error for start>end ,when used for an assumed shape array. program negmem integer, parameter :: N = 3 integer :: i real(kind = 8), dimension(N) :: y = (/ (real(i) , i = 1 , N) /) real(kind = 8) :: scale = 2.0 ! This part is OK do i = 1 , N print * , ' y(' , i+1 , ':' , N , ')' y( i + 1 : N ) = y( i + 1 : N ) / scale print * , y( i + 1 : N ) end do ! This part causes the runtime error call scaler( y , scale , N) print *, 'output from scalar' print * , y stop contains subroutine scaler( y , scale , N ) real(kind =8), dimension(:) :: y real(kind =8) :: scale integer :: N , i do i = 1 , N y( i + 1 : N ) = y( i + 1 : N ) / scale end do return end subroutine scaler end program negmem Produces: y( 2 : 3 ) 1.00000000000000 1.50000000000000 y( 3 : 3 ) 0.750000000000000 y( 4 : 3 ) Fortran runtime error: Attempt to allocate a non-positive amount of memory. -- Summary: Tru64 - runtime error with -ve memory for assumed shape arrays Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: paul dot richard dot thomas at cea dot fr CC: gcc-bugs at gcc dot gnu dot org,paulthomas2 at wanadoo dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18539