From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17031 invoked by alias); 19 Aug 2012 14:08:33 -0000 Received: (qmail 17018 invoked by uid 22791); 19 Aug 2012 14:08:31 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 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; Sun, 19 Aug 2012 14:08:18 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 2D1E8290014 for ; Sun, 19 Aug 2012 16:08:26 +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 Jh-wjx-fe5JB for ; Sun, 19 Aug 2012 16:08:26 +0200 (CEST) Received: from hermes.site (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id F0BED29000F for ; Sun, 19 Aug 2012 16:08:25 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix temporary incorrectly-typed COMPONENT_REF Date: Sun, 19 Aug 2012 14:08:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.34.10-0.6-desktop; KDE/4.4.4; x86_64; ; ) MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_wLPMQFQdvcnhOQz" Message-Id: <201208191606.40023.ebotcazou@adacore.com> 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: 2012-08/txt/msg01277.txt.bz2 --Boundary-00=_wLPMQFQdvcnhOQz Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-length: 540 We generate a temporary incorrectly-typed COMPONENT_REF in gigi when building a derived tagged type with discriminant. That's essentially harmless, but breaks the invariant that the type of the first operand of COMPONENT_REF is aggregate. Tested on x86_64-suse-linux, applied on the mainline. 2012-08-19 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity) : Use proper dummy type for the temporary COMPONENT_REF built for a derived tagged type with discriminant. -- Eric Botcazou --Boundary-00=_wLPMQFQdvcnhOQz Content-Type: text/x-patch; charset="UTF-8"; name="p.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="p.diff" Content-length: 1105 Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 190510) +++ gcc-interface/decl.c (working copy) @@ -2988,6 +2988,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit if (Present (Parent_Subtype (gnat_entity))) { Entity_Id gnat_parent = Parent_Subtype (gnat_entity); + tree gnu_dummy_parent_type = make_node (RECORD_TYPE); tree gnu_parent; /* A major complexity here is that the parent subtype will @@ -2999,11 +3000,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entit each of those discriminants to a COMPONENT_REF of the above dummy parent referencing the corresponding discriminant of the base type of the parent subtype. */ - gnu_get_parent = build3 (COMPONENT_REF, void_type_node, + gnu_get_parent = build3 (COMPONENT_REF, gnu_dummy_parent_type, build0 (PLACEHOLDER_EXPR, gnu_type), build_decl (input_location, FIELD_DECL, NULL_TREE, - void_type_node), + gnu_dummy_parent_type), NULL_TREE); if (has_discr) --Boundary-00=_wLPMQFQdvcnhOQz--