Consider the program program errcode stop 10 end program errcode $ gfortran errcode.f90 $ ./a.out STOP 10 $ echo $? 10 $ gfortran -fdump-core errcode.f90 $ ./a.out STOP 10 Quit (core dumped) $ echo $? 131 Looking at runtime/error.c (sys_exit) the reason is quite obvious; with kill(getpid(), SIGQUIT); the process kills itself (return code is 128 + signal number = 131 in this case) and never gets a chance to execute exit() with the provided exit code!
Assigning to myself, I have some ideas to improve error handling and fix this in the process.
Really assigning this time.
Author: jb Date: Sat May 14 08:44:09 2011 New Revision: 173750 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173750 Log: PR 48915 Abort handling Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/gfortran.texi trunk/gcc/fortran/intrinsic.texi trunk/gcc/fortran/invoke.texi trunk/gcc/fortran/lang.opt trunk/gcc/fortran/options.c trunk/gcc/fortran/trans-decl.c trunk/libgfortran/ChangeLog trunk/libgfortran/intrinsics/abort.c trunk/libgfortran/libgfortran.h trunk/libgfortran/runtime/backtrace.c trunk/libgfortran/runtime/compile_options.c trunk/libgfortran/runtime/environ.c trunk/libgfortran/runtime/error.c trunk/libgfortran/runtime/stop.c
Fixed, closing.
Author: jb Date: Sat May 14 10:20:56 2011 New Revision: 173753 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173753 Log: PR 48915 Update mixed-language programming documentation Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/gfortran.texi
Author: jb Date: Sat May 14 10:24:18 2011 New Revision: 173754 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173754 Log: PR 48915 Update mixed-language programming documentation Modified: trunk/gcc/fortran/gfortran.texi
Author: jb Date: Sun May 15 10:23:53 2011 New Revision: 173770 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173770 Log: PR 48915 Clarify _gfortran_set_options documentation Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/gfortran.texi