https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85307
Bug ID: 85307 Summary: Consistent handling of out-of-bounds access Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: tkoenig at gcc dot gnu.org Target Milestone: --- Currently, we sometimes issue errors and mostly issue warnings for when a compile-time out-of-bounds-access is detected. Example: a.f90:4:30: integer, parameter :: x = b(4) 1 Error: Index in dimension 1 is out of bounds at (1) a.f90:5:12: print *,b(2:4) 1 Warning: Upper array reference at (1) is out of bounds (4 > 3) in dimension 1 a.f90:6:12: print *,b(4) 1 Warning: Array reference at (1) is out of bounds (4 > 3) in dimension 1 a.f90:8:14: do i=1,5 2 print *,b(i) 1 Warning: Array reference at (1) out of bounds (5 > 3) in loop beginning at (2) At the very least, the warnings about the parameter array should be hard errors, and possibly others as well. Let the discussions begin :-)