On Thu, Oct 31, 2019 at 09:42:07AM -0700, Steve Kargl wrote:
> 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,
I think being able to supply the exact code to shell is useful,
perhaps we should just use
exit (code > 255 ? 255 : code);
or similar?
Jakub