I have found a bug in a large program where a subroutine was written as:
program main
implicit none
real, dimension(6) :: x
call f(x, 7)
write (*,*) x
contains
subroutine f(x, n)
integer :: n
real, dimension(n) :: x
integer :: i
do i = 1, n
x(i) = 0.0
end do
end subroutine f
end program main
This program runs fine with both ifort and gfortran and bounds checking even though the code is obviously buggy. Is there an option to catch those kind of bugs?
PS: Here are the two commands that generate binaries that run fine
ifort -check all main.f90 -o maingfortran -fbounds-check main.f90 -o main