Fortran · Runtime error
What does Error 138: Array index out of bounds mean in Fortran?
A subscript expression evaluated to a value outside the array's declared dimensions.
A subscript expression evaluated to a value outside the array's declared dimensions.
Recompile with bounds checking enabled during development, gfortran's -fcheck=bounds or Intel Fortran's /check:bounds, since this class of error is otherwise silent in an optimized build and can corrupt memory instead of reporting cleanly. Note that this check does not always catch every case, particularly a size mismatch on an allocatable array assignment rather than a literal out-of-range subscript, since compile-time shape checking cannot see the runtime size on either side.