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
+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
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;
}
+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
--- /dev/null
+// 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) {}