(j3.2006) exception message on termination
Bill Long
longb
Thu Jun 13 08:35:40 EDT 2013
On 6/12/13 8:23 PM, Van Snyder wrote:
> Bill Long wrote:
>> I was thinking much simpler - the programmer just inserts the CALL
>> before the STOP statement. An industrious programmer could, of
>> course, write such a subroutine using the existing facilities.
>
> I think Bill means "before every STOP statement." If the program stops
> for another reason, say deallocating a disassociated pointer, or
> computing the logarithm of zero, it's a bit hard to insert the call.
>
If the programmer is really interested in having these messages, it is
simple enough to write a MY_STOP subroutine that does the printing and
then executes STOP. Everywhere in the program that a STOP would be
coded, call that routine instead.
Note that the printing of exception information applies only to the STOP
statement (and, it appears, ERROR STOP, though that should not be the
case). It does not apply to exiting the program via END PROGRAM, or by
aborting like hitting a seg fault. Not requiring the output on aborts
is more or less the only viable rule since the Fortran runtime has lost
control of the program by that point. Since aborts do not count here,
we should make it clear in the text that the current rule applies only
to STOP, and not ERROR STOP.
BTW, omitting the STOP just before END PROGRAM is increasingly common
and a good way to avoid both the STOP and exceptions output.
Cheers,
Bill
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the J3
mailing list