From patchwork Wed Jan 21 01:38:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tbsaunde+gcc@tbsaunde.org X-Patchwork-Id: 431300 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 8D9A1140273 for ; Wed, 21 Jan 2015 12:38:53 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=wAh6QaFfjECA b0QQCY4Vy68E0q9ZYXNAt3/s8RiFq7vh+q5LfEzqJ1s4lEcWcbU8QlZr/0kZ4zjy Nk5lEd0ixtsf8fXMVxXzL78fOaO6m+wAM8byDDqhbMwtPyj4yCGR83/5nsK8BrYA ZS9F8RlB3GRjg66CHY0D3ijvPtCdBYg= 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:from :to:cc:subject:date:message-id; s=default; bh=D2xzDmXYiTMgBoJfRB DOlVuakWw=; b=W8udU8MpAEk/zO851j8QOSQsychAqxw+M146NbnSsm4qv2VuMn 97DR9e2WEEhOZOKSqyoOBHY2/sKRtpmJbJqr412MIR9IGETEmHvWTPtfS9wVkCIg RRCBMLtmzlDcNersEgoEC6E8c+m2BSTvk06s6aGRQV+dBjzakdWbHlR8Y= Received: (qmail 18202 invoked by alias); 21 Jan 2015 01:38:43 -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 18180 invoked by uid 89); 21 Jan 2015 01:38:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Jan 2015 01:38:38 +0000 Received: from iceball.corp.tor1.mozilla.com (unknown [66.207.208.102]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id BB6D6C078; Wed, 21 Jan 2015 01:38:35 +0000 (UTC) From: tbsaunde+gcc@tbsaunde.org To: gcc-patches@gcc.gnu.org Cc: Trevor Saunders Subject: [PATCH] pr 64076 - tolerate different definitions of symbols in lto Date: Tue, 20 Jan 2015 20:38:04 -0500 Message-Id: <1421804284-19745-1-git-send-email-tbsaunde+gcc@tbsaunde.org> X-IsSubscribed: yes From: Trevor Saunders Hi, Same patch as before, but now with a test case. I checked this fails without the patch and passes with it, ok? Trev gcc/ * ipa-visibility.c (update_visibility_by_resolution_info): Only assert when not in lto mode. --- gcc/ipa-visibility.c | 18 +++++++++++++----- gcc/testsuite/g++.dg/lto/pr64076.H | 20 ++++++++++++++++++++ gcc/testsuite/g++.dg/lto/pr64076_0.C | 10 ++++++++++ gcc/testsuite/g++.dg/lto/pr64076_1.C | 5 +++++ 4 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/lto/pr64076.H create mode 100644 gcc/testsuite/g++.dg/lto/pr64076_0.C create mode 100644 gcc/testsuite/g++.dg/lto/pr64076_1.C diff --git a/gcc/ipa-visibility.c b/gcc/ipa-visibility.c index 71894af..0791a1c 100644 --- a/gcc/ipa-visibility.c +++ b/gcc/ipa-visibility.c @@ -425,11 +425,19 @@ update_visibility_by_resolution_info (symtab_node * node) if (node->same_comdat_group) for (symtab_node *next = node->same_comdat_group; next != node; next = next->same_comdat_group) - gcc_assert (!next->externally_visible - || define == (next->resolution == LDPR_PREVAILING_DEF_IRONLY - || next->resolution == LDPR_PREVAILING_DEF - || next->resolution == LDPR_UNDEF - || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)); + { + if (!next->externally_visible) + continue; + + bool same_def + = define == (next->resolution == LDPR_PREVAILING_DEF_IRONLY + || next->resolution == LDPR_PREVAILING_DEF + || next->resolution == LDPR_UNDEF + || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP); + gcc_assert (in_lto_p || same_def); + if (!same_def) + return; + } if (node->same_comdat_group) for (symtab_node *next = node->same_comdat_group; diff --git a/gcc/testsuite/g++.dg/lto/pr64076.H b/gcc/testsuite/g++.dg/lto/pr64076.H new file mode 100644 index 0000000..6afe37a --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr64076.H @@ -0,0 +1,20 @@ +struct Base { + virtual void f() = 0; +}; + +struct X : public Base { }; +struct Y : public Base { }; +struct Z : public Base { }; +struct T : public Base { }; + +struct S : public X, public Y, public Z +#ifdef XXX +, public T +#endif +{ + void f() +#ifdef XXX + { } +#endif + ; +}; diff --git a/gcc/testsuite/g++.dg/lto/pr64076_0.C b/gcc/testsuite/g++.dg/lto/pr64076_0.C new file mode 100644 index 0000000..fb9b060 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr64076_0.C @@ -0,0 +1,10 @@ +// { dg-lto-do link } + +#define XXX +#include "pr64076.H" + +int main() +{ + S s; + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/pr64076_1.C b/gcc/testsuite/g++.dg/lto/pr64076_1.C new file mode 100644 index 0000000..4bd0081 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr64076_1.C @@ -0,0 +1,5 @@ +// { dg-options -fno-lto } + +#include "pr64076.H" + +void S::f() { }