I have a Fortran program that should give segmentation fault but it doesn't
问题 As simple as the title. I have a student who got a segmentation fault and I was trying to prove him why does this happen. Instead, I ended up wondering why it doesn't. The code is this: program main implicit none real*8, allocatable:: u(:) integer :: i allocate(u(2)) do i=0, 1000 u(i) = i print *, u(i) enddo end program main I would expect this to crash at i=3 , but it doesn't. Compiled with both ifort and gfortran with -O0 to -O3 回答1: What about turning on the bounds checking option for