re PR tree-optimization/47559 (ICE: verify_stmts failed: statement marked for throw...
authorRichard Guenther <rguenther@suse.de>
Tue, 1 Feb 2011 16:15:56 +0000 (16:15 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 1 Feb 2011 16:15:56 +0000 (16:15 +0000)
2011-02-01  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/47559
* tree-ssa-loop-im.c (can_sm_ref_p): Do not perform
store-motion on references that can throw.

* g++.dg/torture/pr47559.C: New testcase.

From-SVN: r169487

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr47559.C [new file with mode: 0644]
gcc/tree-ssa-loop-im.c

index baf4d94..fc3482c 100644 (file)
@@ -1,3 +1,9 @@
+2011-02-01  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/47559
+       * tree-ssa-loop-im.c (can_sm_ref_p): Do not perform
+       store-motion on references that can throw.
+
 2011-02-01  Bernd Schmidt  <bernds@codesourcery.com>
 
        * tree-dump.c (dump_option_value_info): Add entry for TDF_CSELIB.
index 8773238..26b7e3e 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-01  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/47559
+       * g++.dg/torture/pr47559.C: New testcase.
+
 2011-02-01  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/47565
diff --git a/gcc/testsuite/g++.dg/torture/pr47559.C b/gcc/testsuite/g++.dg/torture/pr47559.C
new file mode 100644 (file)
index 0000000..42dedee
--- /dev/null
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// { dg-options "-std=c++0x -fnon-call-exceptions" }
+
+void foo (int *k) noexcept
+{
+  for (;;)
+    *k = 0;
+}
index 30faeb9..57f9897 100644 (file)
@@ -2318,6 +2318,10 @@ can_sm_ref_p (struct loop *loop, mem_ref_p ref)
       || !for_each_index (&ref->mem, may_move_till, loop))
     return false;
 
+  /* If it can throw fail, we do not properly update EH info.  */
+  if (tree_could_throw_p (ref->mem))
+    return false;
+
   /* If it can trap, it must be always executed in LOOP.
      Readonly memory locations may trap when storing to them, but
      tree_could_trap_p is a predicate for rvalues, so check that