A question on GFortran
Tim Prince
timothyprince@sbcglobal.net
Wed Dec 27 13:31:00 GMT 2006
Angelo Graziosi wrote:
>
> 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.
>
I tried your example with g77 3.4.4, and it does not exhibit the bug
which you would like gfortran to support.
More information about the Fortran
mailing list