]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR ipa/63838 (ipa-pure-const miscomputes can_throw)
authorJakub Jelinek <jakub@redhat.com>
Wed, 12 Nov 2014 23:25:47 +0000 (00:25 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 12 Nov 2014 23:25:47 +0000 (00:25 +0100)
PR ipa/63838
* ipa-pure-const.c (propagate_nothrow): Walk w->indirect_calls
chain instead of node->indirect_calls.

* g++.dg/ipa/pr63838.C: New test.

From-SVN: r217451

gcc/ChangeLog
gcc/ipa-pure-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr63838.C [new file with mode: 0644]

index 99bba83ecde7fe8b5e8b1593fe181cab45433a7b..37584bf147625b385c2532102003cc869f9f0803 100644 (file)
@@ -1,3 +1,9 @@
+2014-11-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR ipa/63838
+       * ipa-pure-const.c (propagate_nothrow): Walk w->indirect_calls
+       chain instead of node->indirect_calls.
+
 2014-11-10  Daniel Hellstrom  <daniel@gaisler.com>
 
        Backport from mainline
index bedc28a8c39cb1981dc4369d7a63d6fdb1220039..e3c4b6aee32ffb89828aa2a24eee847a926b1c23 100644 (file)
@@ -1429,7 +1429,7 @@ propagate_nothrow (void)
              else if (e->can_throw_external && !TREE_NOTHROW (y->symbol.decl))
                can_throw = true;
            }
-          for (ie = node->indirect_calls; ie; ie = ie->next_callee)
+          for (ie = w->indirect_calls; ie; ie = ie->next_callee)
            if (ie->can_throw_external)
              can_throw = true;
          w_info = (struct ipa_dfs_info *) w->symbol.aux;
index 3b05295c12bd99fee2303b547af9da9d849edb66..a4c8f412d8475eda32576e430df857f24b4f9cbd 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR ipa/63838
+       * g++.dg/ipa/pr63838.C: New test.
+
 2014-11-03  Marek Polacek  <polacek@redhat.com>
 
        PR c/52769
diff --git a/gcc/testsuite/g++.dg/ipa/pr63838.C b/gcc/testsuite/g++.dg/ipa/pr63838.C
new file mode 100644 (file)
index 0000000..d673649
--- /dev/null
@@ -0,0 +1,56 @@
+// PR ipa/63838
+// { dg-do run }
+// { dg-options "-O2 -fdump-ipa-pure-const" }
+// { dg-final { scan-ipa-dump-not "Function found to be nothrow: void foo" "pure-const" } }
+// { dg-final { scan-ipa-dump-not "Function found to be nothrow: void bar" "pure-const" } }
+// { dg-final { cleanup-ipa-dump "pure-const" } }
+
+__attribute__((noinline, noclone)) static void bar (int);
+volatile int v;
+void (*fn) ();
+struct S { S () { v++; } ~S () { v++; } };
+
+__attribute__((noinline, noclone)) static void
+foo (int x)
+{
+  v++;
+  if (x == 5)
+    bar (x);
+}
+
+__attribute__((noinline, noclone)) static void
+bar (int x)
+{
+  v++;
+  if (x == 6)
+    foo (x);
+  else if (x == 5)
+    fn ();
+}
+
+__attribute__((noinline, noclone)) int
+baz (int x)
+{
+  S s;
+  foo (x);
+}
+
+void
+throw0 ()
+{
+  throw 0;
+}
+
+int
+main ()
+{
+  fn = throw0;
+  asm volatile ("" : : : "memory");
+  try
+    {
+      baz (5);
+    }
+  catch (int)
+    {
+    }
+}