From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9963 invoked by alias); 29 Apr 2009 13:43:27 -0000 Received: (qmail 9955 invoked by uid 22791); 29 Apr 2009 13:43:25 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Apr 2009 13:43:20 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 45263290003; Wed, 29 Apr 2009 15:43:17 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9Li687Lj8JGg; Wed, 29 Apr 2009 15:43:12 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id 074D22900F6; Wed, 29 Apr 2009 15:43:06 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id B8E91D9A01; Wed, 29 Apr 2009 15:43:05 +0200 (CEST) Date: Wed, 29 Apr 2009 14:35:00 -0000 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Celier Subject: [Ada] Compiler crash when reporting an error during preprocessing Message-ID: <20090429134305.GA32313@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline User-Agent: Mutt/1.5.9i X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-04/txt/msg02342.txt.bz2 --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 640 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 * 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. --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=difs Content-length: 1248 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); --EeQfGwPcQSOJBaQU--