Array Bounds Checking - Standard Behavior?

I think the answers to both of your questions are “no”. Btw,
gfortran -fbounds-check xcheck_bounds.f90 for

program main
  implicit none
  integer :: z(2)
  z = [ 1, 2 ]
  print*,z(sum(z)) ! out-of-bounds detected at run time
  print*,z(3) ! out-of-bounds detected at compile time
end program main

says

xcheck_bounds.f90:6:11:

    6 |   print*,z(3) ! out-of-bounds detected at compile time
      |           1
Warning: Array reference at (1) is out of bounds (3 > 2) in dimension 1

at compile time and gives at run time

At line 5 of file xcheck_bounds.f90
Fortran runtime error: Index '3' of dimension 1 of array 'z' above upper bound of 2
1 Like