On Thu, Oct 31, 2019 at 05:12:39PM +0100, Tobias Burnus wrote:
> At some point, 'call abort()' was changed to 'stop'; this works fine as
> long as exit status is != 0. At least on my Linux system, this works
> until 255. (Which matches POSIX, which requires 8 bits.) For "stop 256",
> I get an exit status == 0.
>
> I am not sure whether other systems break earlier, but I assume most
> support 0 to 255. Currently, gcc/testsuite/*fortran* has those maximal
> 'stop' counts:
FreeBSD's manpage for exit(3) (and _Exit()) states
Both functions make the low-order eight bits of the status
argument available to a parent process which has called a
wait(2)-family function.
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,
Index: runtime/stop.c
===================================================================
--- runtime/stop.c (revision 277638)
+++ runtime/stop.c (working copy)
@@ -123,7 +123,7 @@ stop_numeric (int code, bool quiet)
report_exception ();
st_printf ("STOP %d\n", code);
}
- exit (code);
+ exit (EXIT_FAILURE);
}
--
Steve