On 10/31/19 5:42 PM, Steve Kargl wrote:
I suspect the other BSDs also follow posix. I wonder if gfortran
should either apply a mask to the stop code or simply map nonzero
values to one of EXIT_FAILURE, SIGQUIT, or SIGABRT. Perhaps,
- exit (code);
+ exit (EXIT_FAILURE);
Or "exit (code > 255 ? EXIT_FAILURE : code);". I think EXIT_FAILURE is 1
on most systems. I recall that windows interpreted exit(3) as abort,
which can also be surprising. (But is fine for our testsuite purpose.)
SIGABRT sounds wrong for STOP as:
"Execution of a STOP statement initiates normal termination of
execution. Execution of an ERROR STOP statement initiates error
termination of execution."
Otherwise, the standard states: "When an image is terminated by a STOP
or ERROR STOP statement, its stop code, if any, is made available in a
processor-dependent manner. If the stop-code is an integer, it is
recommended that the value be used as the process exit status, if the
processor supports that concept. If the stop-code in a STOP statement is
of type character or does not appear, or if an end-program-stmt is
executed, it is recommended that the value zero be supplied as the
process exit status, if the processor supports that concept. If the
stop-code in an ERROR STOP statement is of type character or does not
appear, it is recommended that a processor-dependent nonzero value be
supplied as the process exit status, if the processor supports that
concept."
Cheers,
Tobias