ERROR STOP statement
Standard: F77 F90 F95 F2003 F2008 F2018 Example program
<Syntax>
ERROR STOP [ expression ] [ , QUIET = logical-expression ]
The expression must be a scalar constant expression of type Integer or Character, in both cases the kind must be default kind. Fortran 2018 permits the expression to be non-constant.
The logical-expression must be scalar.
Fortran 2018 permits the ERROR STOP statement to appear in a pure subprogram.
<Semantics>
The ERROR STOP statement causes error termination of the program. (If a coarray program has multiple images, error termination will cause every image to terminate.)
Termination of execution by an ERROR STOP statement will display an informative message on the ERROR_UNIT if any IEEE exception is signalling at that time, unless QUIET= appears and the logical-expression has the value .TRUE.; QUIET=.TRUE. also suppresses display of the “stop code” (expression).
The remaining details apply to the NAG Fortran Compiler (they are not guaranteed by the Fortran standard). If expression appears and QUIET=.TRUE. does not appear, the value of the expression is displayed on the standard error unit, prefixed with “ERROR STOP: ”. An integer value is displayed in decimal (I0 format) and a character value is displayed without quotes (A format). If expression does not appear, the message “ERROR STOP” is displayed.
If expression appears and is of type integer, the lower eight bits of its value are returned as the process exit status; otherwise, the process exit status is equal to 2.