This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Ada] prevent recursion through Compiler_Abort
- To: Richard Henderson <rth at redhat dot com>
- Subject: Re: [Ada] prevent recursion through Compiler_Abort
- From: Geert Bosch <bosch at gnat dot com>
- Date: Mon, 8 Oct 2001 08:30:08 -0400 (EDT)
- Cc: gcc-patches at gcc dot gnu dot org
On Sun, 7 Oct 2001, Richard Henderson wrote:
The following prevents the runaway recursion. Ok?
Thanks, yes this patch is OK. Just one minor formatting nit, see below.
I'll check in a document with GNAT formatting guidelines shortly.
-Geert
* 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.
>>Add white line here ...
+ if Abort_In_Progress then
+ Exit_Program (E_Abort);
+ end if;
>> ... and here
+ 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.