From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12813 invoked by alias); 22 May 2017 09:39:57 -0000 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 Received: (qmail 12528 invoked by uid 89); 22 May 2017 09:39:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2453, freeze X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 May 2017 09:39:55 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 440F781347 for ; Mon, 22 May 2017 11:39:57 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O4XCdIq3L1h4 for ; Mon, 22 May 2017 11:39:57 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 1AFF281333 for ; Mon, 22 May 2017 11:39:57 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix ICE on subprogram defined with null exclusion Date: Mon, 22 May 2017 10:08:00 -0000 Message-ID: <5479955.25R4U4yGld@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-53-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart32511826.iKODlEBrBX" Content-Transfer-Encoding: 7Bit X-SW-Source: 2017-05/txt/msg01660.txt.bz2 This is a multi-part message in MIME format. --nextPart32511826.iKODlEBrBX Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 660 It's a regression present on the mainline and 7 branch: the compiler aborts on a package containing a declaration of a subprogram taking an access parameter with null exclusion and a reference to the Access attribute applied to this subprogram. Tested on x86_64-suse-linux, applied on the mainline and 7 branch. 2017-05-22 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity): Skip regular processing for Itypes that are E_Access_Subtype. : Use the DECL of the base type directly. 2017-05-22 Pierre-Marie de Rodat * gnat.dg/specs/not_null1.ads: New test. -- Eric Botcazou --nextPart32511826.iKODlEBrBX Content-Disposition: attachment; filename="not_null1.ads" Content-Transfer-Encoding: 7Bit Content-Type: text/x-adasrc; charset="UTF-8"; name="not_null1.ads" Content-length: 284 -- { dg-do compile } package Not_Null1 is type T is null record; type T_Access is access all T; procedure Proc (This : in not null T_Access) is null; type Proc_Access is access procedure (This : in not null T_Access); PA : Proc_Access := Proc'Access; end Not_Null1; --nextPart32511826.iKODlEBrBX Content-Disposition: attachment; filename="p.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="p.diff" Content-length: 1612 Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 248321) +++ gcc-interface/decl.c (working copy) @@ -310,11 +310,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entit /* Contains the list of attributes directly attached to the entity. */ struct attrib *attr_list = NULL; - /* Since a use of an Itype is a definition, process it as such if it - is not in a with'ed unit. */ + /* Since a use of an Itype is a definition, process it as such if it is in + the main unit, except for E_Access_Subtype because it's actually a use + of its base type, see below. */ if (!definition && is_type && Is_Itype (gnat_entity) + && Ekind (gnat_entity) != E_Access_Subtype && !present_gnu_tree (gnat_entity) && In_Extended_Main_Code_Unit (gnat_entity)) { @@ -3823,7 +3825,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entit case E_Access_Subtype: /* We treat this as identical to its base type; any constraint is meaningful only to the front-end. */ - gnu_type = gnat_to_gnu_type (Etype (gnat_entity)); + gnu_decl = gnat_to_gnu_entity (Etype (gnat_entity), NULL_TREE, false); + saved = true; /* The designated subtype must be elaborated as well, if it does not have its own freeze node. But designated subtypes created @@ -3855,8 +3858,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entit gnat_to_gnu_entity (Directly_Designated_Type (gnat_entity), NULL_TREE, false); } - - maybe_present = true; break; /* Subprogram Entities --nextPart32511826.iKODlEBrBX--