J3/13-268
To: J3
From: Malcolm Cohen
Subject: Interp f08/93 on error termination
Date: 2013 June 24
----------------------------------------------------------------------
NUMBER: F08/0093
TITLE: Process exit status and error termination
KEYWORD: ERROR STOP
DEFECT TYPE: Erratum
STATUS: J3 consideration in progress
QUESTION:
Many operating systems today (e.g. Posix-related ones) use a process
exit status of zero to indicate successful execution, whereas nonzero
indicates an error. (Occasionally nonzero values, e.g. 1, also
indicate success.)
Fortran STOP and ERROR STOP with an integer are
recommended to use the as the exit status. The STOP
statement without an integer is recommended to have an
exit status of zero; this conforms to common practice since STOP
initiates normal termination.
The standard is silent on the effect of error termination, except in
the case of an ERROR STOP (sans integer ) which is
unexpectedly recommended to also return an exit status of zero.
Q1. Is this intentional? Should the exit code for ERROR STOP not have
been recommended to be nonzero?
Q2. Should the recommendation for an ERROR STOP not also apply to
error termination by other causes?
ANSWER:
A1. It was not intended to recommend returning "success" for error
termination. An edit is supplied to correct this.
A2. Yes, the recommendation for an ERROR STOP without an integer
should also apply to other means of standard-defined
error termination. An edit is supplied to correct this omission.
EDIT to 10-007r1:
[33:36+] 2.3.5, before Note 2.7, insert new note
"NOTE 2.6a
If the processor supports the concept of a process exit status, it
is recommended that error termination initiated other than by an
ERROR STOP statement supplies a processor-dependent nonzero value
as the process exit status."
{Recommendation for error termination other than by ERROR STOP.}
[188:10+10] In 8.4, Note 8.30,
Before "is of type character or does not appear"
Insert "in a STOP statement".
{Limit zero recommendation to STOP, not ERROR STOP.}
[188:10+11+] At the end of Note 8.30, insert new paragraphs
"If the in an ERROR STOP statement is of type character
or does not appear, it is recommended that a processor-dependent
nonzero value be supplied at the process exit status, if the
processor supports that concept."
{Specify nonzero exit for ERROR STOP.}
[460:24+] Annex A, after "STOP or ERROR STOP" insert new bullet
"the recommended process exit status when error termination is
initiated other than by an ERROR STOP statement with an integer
;"
{Probably unnecessary, seeing how it is only a recommendation, but
maybe a good idea anyway.}
SUBMITTED BY: Bill Long/Malcolm Cohen
HISTORY: m201 13-nnn Submitted
----------------------------------------------------------------------