This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] PR 47394 Don't ICE on Windows after a fatal error


The problem is that gfortran returned with "exit(3)" for fatal errors. Seemingly, "3" means "abort()" on Windows - thus the driver (gcc.c) duly printed an ICE.

The solution is use the values defined in ./gcc/system.h.

Thanks to Kai for some suggestions and confirming that exit(3) might be regarded as abort().

Build on x86-64-linux.
OK for the trunk? What about other branches?

Tobias

PS: I would be happy if someone could confirm that this patch indeed fixes this old bug.
2011-01-21  Tobias Burnus  <burnus@net-b.de>

	PR fortran/47394
	* error.c (gfc_error_now, gfc_fatal_error, gfc_error_check):
	Use defined instead of magic number exit status codes.
	* scanner.c (include_line, gfc_new_file): Ditto.

diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index 3092828..bedb629 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -939,7 +939,7 @@ gfc_error_now (const char *gmsgid, ...)
   buffer_flag = i;
 
   if (flag_fatal_errors)
-    exit (1);
+    exit (FATAL_EXIT_CODE);
 }
 
 
@@ -956,7 +956,7 @@ gfc_fatal_error (const char *gmsgid, ...)
   error_print (_("Fatal Error:"), _(gmsgid), argp);
   va_end (argp);
 
-  exit (3);
+  exit (FATAL_EXIT_CODE);
 }
 
 
@@ -1019,7 +1019,7 @@ gfc_error_check (void)
       gfc_increment_error_count();
 
       if (flag_fatal_errors)
-	exit (1);
+	exit (FATAL_EXIT_CODE);
     }
 
   return rc;
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index c226bae..ac26a80 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -1868,7 +1868,7 @@ include_line (gfc_char_t *line)
 
   filename = gfc_widechar_to_char (begin, -1);
   if (load_file (filename, NULL, false) == FAILURE)
-    exit (1);
+    exit (FATAL_EXIT_CODE);
 
   gfc_free (filename);
   return true;
@@ -2072,7 +2072,7 @@ gfc_new_file (void)
     printf ("%s:%3d %s\n", LOCATION_FILE (line_head->location),
 	    LOCATION_LINE (line_head->location), line_head->line);
 
-  exit (0);
+  exit (SUCCESS_EXIT_CODE);
 #endif
 
   return result;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]