aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-12-13 09:48:45 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-12-13 09:48:45 +0100
commitcd6d518b2978157020752ae1b5627e7619923930 (patch)
tree8166df4ebffb4989c80fc6adbc1163d94c21c06a /gcc
parent816f4314406078414c7d200fa28ccb680530bed9 (diff)
downloadgcc-cd6d518b2978157020752ae1b5627e7619923930.zip
gcc-cd6d518b2978157020752ae1b5627e7619923930.tar.gz
gcc-cd6d518b2978157020752ae1b5627e7619923930.tar.bz2
re PR ipa/77905 (ICE at -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in ipa_comdats, at ipa-comdats.c:352))
PR ipa/77905 * ipa-pure-const.c (cdtor_p): Return true for DECL_STATIC_{CON,DE}STRUCTOR even when it is DECL_LOOPING_CONST_OR_PURE_P. * g++.dg/ipa/pr77905.C: New test. From-SVN: r243596
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/ipa-pure-const.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr77905.C21
4 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 95e8966..5b478a3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2016-12-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/77905
+ * ipa-pure-const.c (cdtor_p): Return true for
+ DECL_STATIC_{CON,DE}STRUCTOR even when it is
+ DECL_LOOPING_CONST_OR_PURE_P.
+
2016-12-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/78777
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 9732cbf..634dece 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1195,7 +1195,8 @@ static bool
cdtor_p (cgraph_node *n, void *)
{
if (DECL_STATIC_CONSTRUCTOR (n->decl) || DECL_STATIC_DESTRUCTOR (n->decl))
- return !TREE_READONLY (n->decl) && !DECL_PURE_P (n->decl);
+ return ((!TREE_READONLY (n->decl) && !DECL_PURE_P (n->decl))
+ || DECL_LOOPING_CONST_OR_PURE_P (n->decl));
return false;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b4eea72..ac2a4f5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-12-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/77905
+ * g++.dg/ipa/pr77905.C: New test.
+
2016-12-12 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/78777
diff --git a/gcc/testsuite/g++.dg/ipa/pr77905.C b/gcc/testsuite/g++.dg/ipa/pr77905.C
new file mode 100644
index 0000000..0f73d50
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr77905.C
@@ -0,0 +1,21 @@
+// PR ipa/77905
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A {
+ A(int);
+};
+struct B : A {
+ B();
+} A;
+struct C : virtual A {
+ C(int);
+};
+A::A(int x) {
+ if (x)
+ A(0);
+}
+
+B::B() : A(1) {}
+
+C::C(int) : A(1) {}