09-270
To: J3
From: Robert Corbett
Subject: exit after stopping
Date: 2009 July 27
References: 09-007r2
1. Introduction
-- ------------
When Sun Fortran executes a STOP statement or the END statement
of a Fortran main program, it flushes I/O buffers and frees data
structures maintained by the run-time system before calling the
C routine exit. The C exit routine executes any atexit routines
before terminating execution. If the execution of the atexit
routines causes Fortran program units to be executed, the results
might not conform to the requirements of the Fortran standard.
2. Discussion
-- ----------
While the Fortran run-time system could register its shutdown
code as an atexit routine, it cannot guarantee the routine will
be the last atexit routine executed, especially if the main
program is not a Fortran main program.
3. Edits
-- -----
[33:35+ 2.3.5p5]
Add "Executing the C exit() function shall not cause a Fortran
subprogram to be executed."