public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Compiler crash when reporting an error during preprocessing
@ 2009-04-29 14:35 Arnaud Charlet
  0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2009-04-29 14:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: Vincent Celier

[-- Attachment #1: Type: text/plain, Size: 640 bytes --]

When performing preprocessing, there are cases when a compiler built
with assertions will crash when it reports an error. This patch removes
these crashes.
The test is to compile, with a compiler built with assertions, a source
with integrated preprocessing, with a preprocessing error (unknown
symbol, for example) more than 5_000 characters after the beginning of
the source.

Tested on x86_64-pc-linux-gnu, committed on trunk

2009-04-29  Vincent Celier  <celier@adacore.com>

	* sinput-l.adb (Load_File): When preprocessing, set temporarily the
	Source_File_Index_Table entries for the source, to avoid crash when
	reporting an error.


[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 1248 bytes --]

Index: sinput-l.adb
===================================================================
--- sinput-l.adb	(revision 146929)
+++ sinput-l.adb	(working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -453,6 +453,11 @@ package body Sinput.L is
          --  Preprocess the source if it needs to be preprocessed
 
          if Preprocessing_Needed then
+            --  Set temporarily the Source_File_Index_Table entries for the
+            --  source, to avoid crash when reporting an error.
+
+            Set_Source_File_Index_Table (X);
+
             if Opt.List_Preprocessing_Symbols then
                Get_Name_String (N);
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-29 13:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-29 14:35 [Ada] Compiler crash when reporting an error during preprocessing Arnaud Charlet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).