From patchwork Fri Jan 20 19:59:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 137095 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 DBB631007D1 for ; Sat, 21 Jan 2012 06:59:27 +1100 (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=1327694368; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=JsLoIHE rFTMZtvNsT78y3kc//l4=; b=F3w2i5aSl8h81D1KkXCuiyZzTFFhAB5Tzap7I15 UlPOsTrIjXKFKEEQ0FijLCpoCU0XtPHUOIb57TONgBijbKWFdOQWB0eU74EYLycU FfEKITQgaSqFD7j7nDI4RoPTB4rz4shT1FAoHd+Vi6uIMRpbNx+FQ7me2Ezl2EeG XG8U= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=faTd2+HjH7IVes2fFmCYFHwia0/uvJzlO+UiR2W8QVvaAAMHqt4wOeMYw8QZhx 8+f24PuT3YbTsS+pMB0chQc3+shxu73wIBOQwSbcvrK8EeAmVvioD60oRBGb8QuY N+P1gAQo5cOeVfMUML7q0Oc5Dley+YSz4nnXvJyOdN8Bk=; Received: (qmail 1749 invoked by alias); 20 Jan 2012 19:59:22 -0000 Received: (qmail 1737 invoked by uid 22791); 20 Jan 2012 19:59:22 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 20 Jan 2012 19:59:07 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0KJx7hI019062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 20 Jan 2012 14:59:07 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q0KJx6p1014382; Fri, 20 Jan 2012 14:59:07 -0500 Received: from [0.0.0.0] (ovpn-113-137.phx2.redhat.com [10.3.113.137]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id q0KJx43m003460; Fri, 20 Jan 2012 14:59:05 -0500 Message-ID: <4F19C788.8020909@redhat.com> Date: Fri, 20 Jan 2012 14:59:04 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: gcc-patches List , Jan Hubicka Subject: varpool PATCH for c++/51832 (multiply defined symbol with LTO plugin) 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 As a result of my recent mangling work, any code that uses variadic templates will use the forward-compatibility aliases because the mangling of argument packs has changed. This exposed an issue that we weren't copying DECL_EXTERNAL from decl to alias along with other linkage flags in varpool_analyze_pending_decls. Fixed thus. It would be nice for the front end to fix up the linkage flags appropriately, but this small change seems preferable for 4.7. Tested x86_64-pc-linux-gnu. OK for trunk? commit ef67d3adcc8accbc75acb6b81a28f231aaddfc35 Author: Jason Merrill Date: Fri Jan 20 13:32:39 2012 -0500 PR c++/51832 * varpool.c (varpool_analyze_pending_decls): Copy DECL_EXTERNAL for extra name aliases. diff --git a/gcc/testsuite/g++.dg/lto/pr51832.h b/gcc/testsuite/g++.dg/lto/pr51832.h new file mode 100644 index 0000000..fee3693 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr51832.h @@ -0,0 +1,6 @@ +template struct A +{ + static int i; +}; + +inline void f() { A::i = 0; } diff --git a/gcc/testsuite/g++.dg/lto/pr51832_0.C b/gcc/testsuite/g++.dg/lto/pr51832_0.C new file mode 100644 index 0000000..e99cea4 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr51832_0.C @@ -0,0 +1,8 @@ +// PR c++/51832 +// { dg-lto-do link } +// { dg-lto-options { "-std=c++11 -flto -fabi-version=2" } } + +#include "pr51832.h" + +int main() { } + diff --git a/gcc/testsuite/g++.dg/lto/pr51832_1.C b/gcc/testsuite/g++.dg/lto/pr51832_1.C new file mode 100644 index 0000000..6f0137b --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr51832_1.C @@ -0,0 +1 @@ +#include "pr51832.h" diff --git a/gcc/varpool.c b/gcc/varpool.c index 74fc1ba..e01accb 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -484,6 +484,7 @@ varpool_analyze_pending_decls (void) { DECL_WEAK (node->decl) = DECL_WEAK (node->alias_of); TREE_PUBLIC (node->decl) = TREE_PUBLIC (node->alias_of); + DECL_EXTERNAL (node->decl) = DECL_EXTERNAL (node->alias_of); DECL_VISIBILITY (node->decl) = DECL_VISIBILITY (node->alias_of); if (TREE_PUBLIC (node->decl)) {