$ cat > a.f90 program test integer, dimension(:), allocatable :: x allocate(x(10)) call use_array(x) contains subroutine use_array(x) integer, dimension(:), intent(in) :: x integer, dimension(20) :: y y = x end subroutine use_array end program
$ gfortran -fbounds-check a.f90 && ./a.out At line 9 of file a.f90 Fortran runtime error: Array bound mismatch, size mismatch for dimension 1 of array 'y' (19/9) -- Summary: Off-by-one runtime bounds checking message Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fxcoudert at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36029