From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8856 invoked by alias); 1 Aug 2011 14:38:12 -0000 Received: (qmail 8787 invoked by uid 22791); 1 Aug 2011 14:38:11 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 01 Aug 2011 14:37:53 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 37537CB0255; Mon, 1 Aug 2011 16:37:52 +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 K3gUtDDeQen5; Mon, 1 Aug 2011 16:37:42 +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 F2827CB01F8; Mon, 1 Aug 2011 16:37:41 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id D5B2C85978; Mon, 1 Aug 2011 16:37:44 +0200 (CEST) Date: Mon, 01 Aug 2011 14:38:00 -0000 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [Ada] Avoid FE crash processing wrong sources Message-ID: <20110801143744.GA24317@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="J2SCkAp4GZ/dPZZf" 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: 2011-08/txt/msg00054.txt.bz2 --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 759 This patch avoids the frontend crash when generated with assertions enabled and it process the following wrong sources in which partial view is not a synchronized tagged type as requested by RM 7.3 (7.2/2). package RT is type I is protected interface; type T is tagged limited private; private protected type T is new I with -- ERROR end T; end RT; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-08-01 Javier Miranda * sem_util.adb (Abstract_Interface_List): Complete condition when processing private type declarations to avoid reading unavailable attribute. (Is_Synchronized_Tagged_Type): Complete condition when processing private extension declaration nodes to avoid reading unavailable attribute. --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=difs Content-length: 1072 Index: sem_util.adb =================================================================== --- sem_util.adb (revision 177035) +++ sem_util.adb (working copy) @@ -165,7 +165,10 @@ Nod := Type_Definition (Parent (Typ)); elsif Nkind (Parent (Typ)) = N_Private_Type_Declaration then - if Present (Full_View (Typ)) then + if Present (Full_View (Typ)) + and then Nkind (Parent (Full_View (Typ))) + = N_Full_Type_Declaration + then Nod := Type_Definition (Parent (Full_View (Typ))); -- If the full-view is not available we cannot do anything else @@ -7335,6 +7338,7 @@ and then Is_Synchronized_Interface (E)) or else (Ekind (E) = E_Record_Type_With_Private + and then Nkind (Parent (E)) = N_Private_Extension_Declaration and then (Synchronized_Present (Parent (E)) or else Is_Synchronized_Interface (Etype (E)))); end Is_Synchronized_Tagged_Type; --J2SCkAp4GZ/dPZZf--