http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48915
Summary: Incorrect process return code with -fdump-core Product: gcc Version: unknown Status: UNCONFIRMED Severity: minor Priority: P3 Component: libfortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: j...@gcc.gnu.org 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!