(j3.2006) (SC22WG5.5104) [ukfortran] WG5 letter ballot 7 on Fortran 2008 interpretations

Malcolm Cohen malcolm
Mon Oct 21 05:36:45 EDT 2013


Nick Maclaren wrote:
>On Oct 21 2013, Malcolm Cohen wrote:
>>
>>>F08/0093
>>>
>>>My vote is "no" solely because this seems to assume the POSIX view of
>>>error status without specifying it.  For example, VMS (which is still
>>>twitching) uses a different conventions, and zOS is also slightly
>>>different.  Prepending some description like this to NOTE 2.6a would
>>>change my vote:
>>>
>>>    In the recommendations for a program exit status, it is
>>>    assumed that it is an integer with zero indicating success;
>>>    processors that use other conventions should interpret the
>>>    recommendations accordingly.
>>
>> This is already assumed by the current text specifying a zero return value 
>> for plain STOP, i.e. although in principle I agree that the status return 
>> values could be better-specified, this interp is really only about the 
>> inconsistent way we went about it.
>
>I know :-(  But this interpretation actually does more than that,
>because the current wording (2.3.5p4, Note 8.30 and 13.7.57p3) does not
>even imply that the exit status value bears any particular relationship
>to success or failure.  And it is the introduction of that linkage
>that I feel should be done properly.

(a) The current wording certainly does have some kind of implication, since the 
default STOP was defined to return zero.  Even though we made ERROR STOP to do 
the same (clearly a mistake), that means that success must be zero.  In 
practical terms, unless we had provided named constants for NORMAL_EXIT_CODE and 
ERROR_EXIT_CODE (though maybe the latter should have been a function) in 
ISO_FORTRAN_ENV, there is little the user can do other than to assume that 
success is zero.  And since there are many possibilities for error but only one 
for normality, it is natural that zero must be for normal termination.

(b) The wording being inserted into the standard does not mention success or 
failure anywhere.  I will cop to "normal" and "error" termination though.

(c) Just because the Fortran processor has a process exit status of N does not 
mean that the shell gets a process exit status of N.  How the process exit code 
gets communicated to the shell is (clearly!) outwith the scope of the standard. 
If the shell thinks that 2==success, odd=error, and zero==reboot the operating 
system, one might reasonably conjecture that the Fortran processor to shell 
interaction might perform some kind of translation of the raw exit code so as to 
accommodate the shell.

(d) The standard is supposed to promote portability, and that means the user 
should not have to guess what the success code is supposed to be - see (a). 
Certainly the idea of having to change one's STOP statements when moving from 
one system to another is not a good one.

(e) I appreciate that people like things to be "done properly", but we decided 
not to "do it properly" way back when we made this a soft recommendation 
already.  Here all we are concerned about is fixing the normal/error termination 
glitch.

(f) Your suggested wording is certainly unacceptable to me.  "assume it is an 
integer" forsooth.  Prior to this interp we *already* assumed that, and with 
good reason.

(g) Since this is only a recommendation, and a recommendation to follow 
widespread industry practice at that, I see no need for further weasel-wording. 
If we were going to normatively require stuff then we certainly would have to 
think about and explain Fortran-shell interactions, but:

   By Making It A Recommendation Only, We Have Already Covered The Other Systems 
You Refer To.

No further accommodation is needed.

Cheers,
-- 
................................Malcolm Cohen, Nihon NAG, Tokyo. 




More information about the J3 mailing list