[Ada] prevent recursion through Compiler_Abort

Richard Henderson rth@redhat.com
Sun Oct 7 13:18:00 GMT 2001


I've been able to get most of Ada to build on one of my x86
boxes, but I get a number of aborts building gnatlib_and_tools.

In addition, something is being mis-compiled (or data structures
corrupted, or...) in the sjlj exception handling code, and the
"raise Unrecoverable_Error" at the end of Compiler_Abort crashes,
which then comes back to Compiler_Abort via the SIGSEGV handler
ad infinitum until all available stack space is used and the 
kernel kills the program because it can't send another signal.

The following prevents the runaway recursion.  Ok?


r~


	* comperr.adb (Abort_In_Progress): New.
	(Compiler_Abort): Use it to prevent recursion.

Index: comperr.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/comperr.adb,v
retrieving revision 1.1
diff -u -p -r1.1 comperr.adb
--- comperr.adb	2001/10/02 14:08:30	1.1
+++ comperr.adb	2001/10/07 20:06:40
@@ -51,6 +51,14 @@ with System.Soft_Links; use System.Soft_
 
 package body Comperr is
 
+   ----------------
+   -- Local Data --
+   ----------------
+
+   Abort_In_Progress : Boolean := False;
+   --  Used to prevent runaway recursion if something segfaults
+   --  while processing a previous abort.
+
    -----------------------
    -- Local Subprograms --
    -----------------------
@@ -82,6 +90,12 @@ package body Comperr is
    --  Start of processing for Compiler_Abort
 
    begin
+      --  Prevent recursion through Compiler_Abort, e.g. via SIGSEGV.
+      if Abort_In_Progress then
+         Exit_Program (E_Abort);
+      end if;
+      Abort_In_Progress := True;
+
       --  If errors have already occured, then we guess that the abort may
       --  well be caused by previous errors, and we don't make too much fuss
       --  about it, since we want to let the programmer fix the errors first.



More information about the Gcc-patches mailing list