http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47394

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-21 
13:17:55 UTC ---
This seems to be a Windows / MinGW specific problem caused by the way gfortran
returns when a fatal error occurs.

gfortran just calls
   exit(3);

which according to Kai matches Windows' abort status code.

The proper way seems to use the system.h's exit codes: FATAL_EXIT_CODE,
EXIT_SUCCESS and EXIT_FAILURE instead of hard-coded error codes.


The error message itself is printed by the driver (gcc.c, gfortran.exe) and not
by the proper compiler (f951.exe).


Draft patch:

diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index 3092828..8520e2a 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -941,3 +941,3 @@ gfc_error_now (const char *gmsgid, ...)
   if (flag_fatal_errors)
-    exit (1);
+    exit (EXIT_FAILURE);
 }
@@ -958,3 +958,3 @@ gfc_fatal_error (const char *gmsgid, ...)

-  exit (3);
+  exit (FATAL_EXIT_CODE);
 }
@@ -1021,3 +1021,3 @@ gfc_error_check (void)
       if (flag_fatal_errors)
-       exit (1);
+       exit (EXIT_FAILURE);
     }
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index c226bae..d4388e0 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -1870,3 +1870,3 @@ include_line (gfc_char_t *line)
   if (load_file (filename, NULL, false) == FAILURE)
-    exit (1);
+    exit (EXIT_FAILURE);

@@ -2074,3 +2074,3 @@ gfc_new_file (void)

-  exit (0);
+  exit (EXIT_SUCCESS);
 #endif

Reply via email to