aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-03-02 23:19:37 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2014-03-02 22:19:37 +0000
commit9ffbf2714bac6ab0521df5edcc2149ef20ebb762 (patch)
tree5e8cb9726985c6860c6d592db3fc1617ee95291e /gcc
parent993df21e9aacba1ff3236e0e0df0118573de8190 (diff)
downloadgcc-9ffbf2714bac6ab0521df5edcc2149ef20ebb762.zip
gcc-9ffbf2714bac6ab0521df5edcc2149ef20ebb762.tar.gz
gcc-9ffbf2714bac6ab0521df5edcc2149ef20ebb762.tar.bz2
re PR lto/60150 (ICE in function_and_variable_visibility, at ipa.c:1000)
PR ipa/60150 * ipa.c (function_and_variable_visibility): When dissolving comdat group, also set all symbols to local. * g++.dg/lto/pr60150.H: New testcase. * g++.dg/lto/pr60150_0.C: New testcase. * g++.dg/lto/pr60150_1.C: New testcase. From-SVN: r208262
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa.c31
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/lto/pr60150.H20
-rw-r--r--gcc/testsuite/g++.dg/lto/pr60150_0.C8
-rw-r--r--gcc/testsuite/g++.dg/lto/pr60150_1.C4
6 files changed, 69 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b6f1dac..c056946 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,10 @@
2014-03-02 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/60150
+ * ipa.c (function_and_variable_visibility): When dissolving comdat
+ group, also set all symbols to local.
+
+2014-03-02 Jan Hubicka <hubicka@ucw.cz>
PR ipa/60306
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 405ee64..da97554 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -970,15 +970,32 @@ function_and_variable_visibility (bool whole_program)
gcc_assert (whole_program || in_lto_p
|| !TREE_PUBLIC (node->decl));
node->unique_name = ((node->resolution == LDPR_PREVAILING_DEF_IRONLY
- || node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
- && TREE_PUBLIC (node->decl));
+ || node->unique_name
+ || node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
+ && TREE_PUBLIC (node->decl));
node->resolution = LDPR_PREVAILING_DEF_IRONLY;
if (node->same_comdat_group && TREE_PUBLIC (node->decl))
- /* cgraph_externally_visible_p has already checked all other nodes
- in the group and they will all be made local. We need to
- dissolve the group at once so that the predicate does not
- segfault though. */
- symtab_dissolve_same_comdat_group_list (node);
+ {
+ symtab_node *next = node;
+
+ /* Set all members of comdat group local. */
+ if (node->same_comdat_group)
+ for (next = node->same_comdat_group;
+ next != node;
+ next = next->same_comdat_group)
+ {
+ symtab_make_decl_local (next->decl);
+ next->unique_name = ((next->resolution == LDPR_PREVAILING_DEF_IRONLY
+ || next->unique_name
+ || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
+ && TREE_PUBLIC (next->decl));
+ }
+ /* cgraph_externally_visible_p has already checked all other nodes
+ in the group and they will all be made local. We need to
+ dissolve the group at once so that the predicate does not
+ segfault though. */
+ symtab_dissolve_same_comdat_group_list (node);
+ }
symtab_make_decl_local (node->decl);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 864057e..7db73e4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2014-03-02 Jan Hubicka <hubicka@ucw.cz>
+ PR ipa/60150
+ * g++.dg/lto/pr60150.H: New testcase.
+ * g++.dg/lto/pr60150_0.C: New testcase.
+ * g++.dg/lto/pr60150_1.C: New testcase.
+
+2014-03-02 Jan Hubicka <hubicka@ucw.cz>
+
PR ipa/60306
* testsuite/g++.dg/ipa/devirt-29.C: New testcase
diff --git a/gcc/testsuite/g++.dg/lto/pr60150.H b/gcc/testsuite/g++.dg/lto/pr60150.H
new file mode 100644
index 0000000..6afe37a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr60150.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/pr60150_0.C b/gcc/testsuite/g++.dg/lto/pr60150_0.C
new file mode 100644
index 0000000..cc21820
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr60150_0.C
@@ -0,0 +1,8 @@
+// { dg-lto-do run }
+#include "pr60150.H"
+
+int main()
+{
+ S s;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr60150_1.C b/gcc/testsuite/g++.dg/lto/pr60150_1.C
new file mode 100644
index 0000000..294e5f0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr60150_1.C
@@ -0,0 +1,4 @@
+// { dg-options "-fno-lto" }
+#include "pr60150.H"
+
+void S::f() { }