[Flang-dev] FORTRAN STOP

Paul Osmialowski pawel.osmialowski at foss.arm.com
Tue Oct 10 18:43:07 EDT 2017

Hello all,

There was a discussion among some of long-time Fortran users in our team 
about FORTRAN STOP message that Flang prints.

Their concern is that programs compiled by the compilers other than 
Flang don't print any message for the STOP command in Fortran, unless 
there is 1) a string message argument, 2) an integer argument, or 3) a 
non-zero exit code, whereas Flang compiled programs always prints 
"FORTRAN STOP". Not saying this is a problem, but wondering if Flang 
should also be silent.

To disable it one just set NO_STOP_MESSAGES=1 in the shell environment. 
It turns of all STOP messages, signal or not, which some of us don’t 
think is ideal.

Intel compiler doesn’t give you either message. Unless you make it with 
‘-standard-semantics’. In which case, it does throw the IEEE with, say, 
a div. by 0, but doesn’t give you a ‘FORTRAN STOP’ message for a clean, 
signal-free stop. The standard is vague when it comes to reporting 
signals on stop, and Intel’s behaviour isn’t entirely consistent.

If IBM, GNU and Intel compilers never print anything for a STOP 
statement with no argument and zero exit status then some of us think we 
should do the same, but some others have an idea of switching the 
behaviour and having a PRINT_STOP_MESSAGE environment variable.

Other proposal on environment variable:

NO_STOP_MESSAGES=0 => always print on stop
NO_STOP_MESSAGES unset => only print on signal (different to PGI)
NO_STOP_MESSAGES>0 => never print on stop, whatever happens.

Can Flang developers provide some input to our discussion as where the 
decision to print “FORTRAN STOP” came from, and is there a point to 
change this behaviour for Flang?

Best regards,
Paul Osmialowski

More information about the flang-dev mailing list