From patchwork Tue Jan 28 17:06:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 314786 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D95F82C0079 for ; Wed, 29 Jan 2014 04:06:36 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=jFypjNQc3fWEGtBTm k6ODjF/VT5u8HUCaBUWy0DsGKqYQ9JZxku+RsTeFPfCmwwd4B+l4GnSKY6M+5Lfy 2y/bESx/vFUWf6mPsE5ObKdIzWv8gi8RUEagFRypVC9N3he36nnyjtYQgeSaYzqj S0fdd4Ra0v1YzySydXy2Bsngio= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=default; bh=sO1KmrMMDplFoaaU5Y0HC3e 98KA=; b=MC+wgimIjyb8XBb8LNEgzkf9rhpoR0SlwBnkLPAhH9sX8OYkIk5V36X tGlysBlWvx9SRMMECol4wV+iZ4OFFtR9V2NhrJgaC+8sSKIa+QdQ4Z4wJCqumqda F/xYscbXBSZYuwPABZSDwt70Kcz3FNbbpaJeZG0r8MNHBWqij96E= Received: (qmail 12588 invoked by alias); 28 Jan 2014 17:06:29 -0000 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 Received: (qmail 12573 invoked by uid 89); 28 Jan 2014 17:06:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Jan 2014 17:06:28 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0SH6QbT023782 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 28 Jan 2014 12:06:26 -0500 Received: from [10.10.116.19] ([10.10.116.19]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s0SH6Prw031863 for ; Tue, 28 Jan 2014 12:06:25 -0500 Message-ID: <52E7E391.2010907@redhat.com> Date: Tue, 28 Jan 2014 12:06:25 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: gcc-patches List Subject: Re: C++ PATCH for c++/54652 (ICE with repeated typedef/attribute) References: <52E72F20.1050703@redhat.com> In-Reply-To: <52E72F20.1050703@redhat.com> It occurred to me that we don't need to call merge_types at all if we're just going to throw away the result. commit 00a4445cf80b647d14144c9b509cf06d052a888e Author: Jason Merrill Date: Tue Jan 28 08:50:23 2014 -0500 * decl.c (duplicate_decls): Tweak. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c93c783..aca96fc 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1923,13 +1923,13 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) if (TREE_CODE (newdecl) == FUNCTION_DECL) maybe_instantiate_noexcept (olddecl); - /* Merge the data types specified in the two decls. */ - newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl)); - /* For typedefs use the old type, as the new type's DECL_NAME points at newdecl, which will be ggc_freed. */ if (TREE_CODE (newdecl) == TYPE_DECL) newtype = oldtype; + else + /* Merge the data types specified in the two decls. */ + newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl)); if (VAR_P (newdecl)) {