From patchwork Sun Aug 19 14:06:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 178561 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 240D02C008B for ; Mon, 20 Aug 2012 00:08:40 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1345990121; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:User-Agent:MIME-Version: Content-Type:Message-Id:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=4UWwL/fq+k+IxBpJCU5BK2MOq0o=; b=gyByoUiEm89diVn /9V7JiNySCEvKDoANZTf3kgkR8l2dqicrylyrW/LdIta1qXL2BWb4/Ib8RqYQmUF C+VpZUKtr7Nyat3AThUIXT8Y59aN12lSxo2pzqsTGiDttYfJ2PBfRNiKT+54aZjl LzyguJcR/cuG2tQlLE/7b4Hg6f9A= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Subject:Date:User-Agent:MIME-Version:Content-Type:Message-Id:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=tKf9825+l61OyJhUtWBQXHzLRa7dqjuIVN1epbsuI1LlAmIcmq9jX3qrBLb1hI eP2jHOzbBK8sM7/FQc0C8CzinZPEXjOIR5PYAN3ygi1ui+V/9MADuF5sOHpPrR46 XGujndlZG81AtSxFj0ofuyAcazvJaNKCJu3L0zdG+eB50=; 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 16:06:39 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.34.10-0.6-desktop; KDE/4.4.4; x86_64; ; ) MIME-Version: 1.0 Message-Id: <201208191606.40023.ebotcazou@adacore.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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. 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)