From: Trevor Saunders <tbsaunde+...@tbsaunde.org>

Hi,

when doing an lto link we can have some symbols be ir only and others be
machine code, which trips the assert here.  Just adjust the assert to handle
that.

bootstrapped + regtested x86_64-linux-gnu, ok?

Trev

gcc/

        * ipa-visibility.c (update_visibility_by_resolution_info): Only
        assert when not in lto mode.
---
 gcc/ipa-visibility.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

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;
-- 
2.1.4

Reply via email to