From patchwork Sat May 26 10:38:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 161477 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 AF086B6FA3 for ; Sat, 26 May 2012 20:44:29 +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=1338633871; 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=nA+lDutBmnswWRMKJcDHlOWNXUU=; b=cbQRX9BvoVUmoGJ l76iJSjphkgEGmaN+ZCfIrJJ+m0PXLSysvivHFV4OgrbHM9kYB62pqRDTQvO1FY2 GNfTLt6UoDdQpMk3FHneoG5pw+WXqATmT0cyMqEitMP5F3w8QarxAK5ZIgP8BWaT 74XBsNqQP2dMIN9h8FoUoG7rsaTU= 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=ZamiqtKHr4in3AL/frfw3qHaa7skBjuiQkdS/EAd4qJZRmmSM2IIZbe6F22p06 1OCvSomYU1RhRHKvyQDPxM3VRAlUQctay2WhBYxZxSkeoqgFmhwx9uK7QsVrUx6O 7N181oGxGzH9Ja+/9j+OHX22D4O5uZmyziO9/ebSC1vCg=; Received: (qmail 6156 invoked by alias); 26 May 2012 10:44:25 -0000 Received: (qmail 6145 invoked by uid 22791); 26 May 2012 10:44:24 -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; Sat, 26 May 2012 10:44:11 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 40EA5290028 for ; Sat, 26 May 2012 12:44:16 +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 j3BYz8imxIau for ; Sat, 26 May 2012 12:44:16 +0200 (CEST) Received: from [192.168.1.2] (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 0970C29000C for ; Sat, 26 May 2012 12:44:16 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Small tweak to type derivation machinery Date: Sat, 26 May 2012 12:38:49 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201205261238.49576.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 To have the name of the types of the variant part and the fields therein be unique instead of mere duplicates of those of the base type, which makes it easier to debug type merging issues in LTO mode. Tested on i586-suse-linux, applied on the mainline, 4.7 and 4.6 branches. 2012-05-26 Eric Botcazou * gcc-interface/decl.c (variant_desc): Rename 'record' to 'new_type'. (build_variant_list): Adjust to above renaming. (gnat_to_gnu_entity) : Likewise. Give a unique name to the type of the variant containers. (create_variant_part_from): Likewise. Give a unique name to the type of the variant part. Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 187833) +++ gcc-interface/decl.c (working copy) @@ -119,8 +119,8 @@ typedef struct variant_desc_d { /* The value of the qualifier. */ tree qual; - /* The record associated with this variant. */ - tree record; + /* The type of the variant after transformation. */ + tree new_type; } variant_desc; DEF_VEC_O(variant_desc); @@ -3318,11 +3318,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entit { tree old_variant = v->type; tree new_variant = make_node (RECORD_TYPE); + tree suffix + = concat_name (DECL_NAME (gnu_variant_part), + IDENTIFIER_POINTER + (DECL_NAME (v->field))); TYPE_NAME (new_variant) - = DECL_NAME (TYPE_NAME (old_variant)); + = concat_name (TYPE_NAME (gnu_type), + IDENTIFIER_POINTER (suffix)); copy_and_substitute_in_size (new_variant, old_variant, gnu_subst_list); - v->record = new_variant; + v->new_type = new_variant; } } else @@ -3426,7 +3431,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit if (selected_variant) gnu_cont_type = gnu_type; else - gnu_cont_type = v->record; + gnu_cont_type = v->new_type; } else /* The front-end may pass us "ghost" components if @@ -7562,7 +7567,7 @@ build_variant_list (tree qual_union_type v->type = variant_type; v->field = gnu_field; v->qual = qual; - v->record = NULL_TREE; + v->new_type = NULL_TREE; /* Recurse on the variant subpart of the variant, if any. */ variant_subpart = get_variant_part (variant_type); @@ -8238,7 +8243,9 @@ create_variant_part_from (tree old_varia /* First create the type of the variant part from that of the old one. */ new_union_type = make_node (QUAL_UNION_TYPE); - TYPE_NAME (new_union_type) = DECL_NAME (TYPE_NAME (old_union_type)); + TYPE_NAME (new_union_type) + = concat_name (TYPE_NAME (record_type), + IDENTIFIER_POINTER (DECL_NAME (old_variant_part))); /* If the position of the variant part is constant, subtract it from the size of the type of the parent to get the new size. This manual CSE @@ -8272,7 +8279,7 @@ create_variant_part_from (tree old_varia continue; /* Retrieve the list of fields already added to the new variant. */ - new_variant = v->record; + new_variant = v->new_type; field_list = TYPE_FIELDS (new_variant); /* If the old variant had a variant subpart, we need to create a new