Searching for this question I found this SO thread, and the suggestion is to use stop N. Is that a standard way to do it? Seems from the discussion that sometimes the number gets printed, or not, depending on the OS or the compiler.
What I want is a flag to allow easier handling of errors from the output of a Fortran program, using an upper level script.
A process exit code has not always been a thing, and thus the Fortran standard cannot mandate anything about it. I will note that I have had fairly good luck with stop n passing n as the exit code on all platforms and compilers that I care about. I will note that detecting it on Windows is occasionally a bit finicky, I suspect more due to the idiosyncrasies of the cmd and/or batch shells than problems in the Fortran compilers or run-time systems.