From a9e083cc43d5e4c5917bfb1663fb1a34b7c2b065 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Tue, 10 Feb 2015 02:23:11 +0000 Subject: [PATCH] Tolerate different definitions of symbols in lto gcc/ PR lto/64076 * ipa-visibility.c (update_visibility_by_resolution_info): Only assert when not in lto mode. From-SVN: r220561 --- gcc/ChangeLog | 6 ++++++ 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 +++++ 5 files changed, 54 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/ChangeLog b/gcc/ChangeLog index 83bc9112535..d98276b80b3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-02-09 Trevor Saunders + + PR lto/64076 + * ipa-visibility.c (update_visibility_by_resolution_info): Only + assert when not in lto mode. + 2015-02-09 Zhouyi Zhou * ira-color.c (setup_left_conflict_sizes_p): Simplify diff --git a/gcc/ipa-visibility.c b/gcc/ipa-visibility.c index 00b28e6e89c..a8ac971b848 100644 --- a/gcc/ipa-visibility.c +++ b/gcc/ipa-visibility.c @@ -424,11 +424,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 00000000000..6afe37acc9c --- /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 00000000000..fb9b060e323 --- /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 00000000000..4bd00817b1d --- /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() { } -- 2.30.2