Let us consider the following program
----------------------------------------------------
$ cat h.F
program hello
implicit none
integer i
i = 0
if (i.eq.0) stop 99901
write(*,*) 'Hello!'
end
----------------------------------------------------
and the following script
------------------------------------
$ cat run_h.sh
#!/bin/bash
build()
{
./h || return 1
echo "Hello"
}
build
------------------------------------
When one builds 'h.F' with G77, running the script, the result is:
-----------------------------------------
g77 h.F -o h
$ ./run_h.sh
STOP 99901 statement executed
Hello
-----------------------------------------
If, instead, one build 'h.F' with GFortran:
---------------------------------------
$ gfc h.F -o h
$ ./run_h.sh
STOP 99901
---------------------------------------
i.e. in the first case the script line
echo "Hello"
is executed, in the second NO.
This is because G77 does not intercept the execution of
STOP 99901
like an abnormal termination.
I would ask if there is a GFC option or environment variable to set so
that the GFC behaviour is similar to that of G77.