]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/45569 (ICE: verify_stmts failed: statement marked for throw in middl...
authorRichard Guenther <rguenther@suse.de>
Tue, 7 Sep 2010 12:27:45 +0000 (12:27 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 7 Sep 2010 12:27:45 +0000 (12:27 +0000)
2010-09-07  Richard Guenther  <rguenther@suse.de>

PR middle-end/45569
* tree-eh.c (operation_could_trap_helper_p): Neither COMPLEX_EXPR
nor CONSTRUCTOR can trap.
* tree-complex.c (update_complex_assignment): Update EH info.

* g++.dg/eh/pr45569.C: New testcase.

From-SVN: r163947

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/eh/pr45569.C [new file with mode: 0644]
gcc/tree-complex.c
gcc/tree-eh.c

index 6bad3906b3ebf51d35b1d4d6a90898f818fc059b..200f11f2efea5349daa279ba13c4624b623c524f 100644 (file)
@@ -1,3 +1,10 @@
+2010-09-07  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/45569
+       * tree-eh.c (operation_could_trap_helper_p): Neither COMPLEX_EXPR
+       nor CONSTRUCTOR can trap.
+       * tree-complex.c (update_complex_assignment): Update EH info.
+
 2010-09-07  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/45569
index 99c91b4c3e0aa62e110a14bd3a07270df80f1bd0..37717423f62018027ab938faabe9026000b3d77e 100644 (file)
@@ -1,3 +1,8 @@
+2010-09-07  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/45569
+       * g++.dg/eh/pr45569.C: New testcase.
+
 2010-09-07  Bernd Schmidt  <bernds@codesourcery.com>
 
        PR target/43137
diff --git a/gcc/testsuite/g++.dg/eh/pr45569.C b/gcc/testsuite/g++.dg/eh/pr45569.C
new file mode 100644 (file)
index 0000000..2c100d2
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-O -fnon-call-exceptions" }
+
+float f ();
+_Complex float g ();
+
+void
+i (_Complex float);
+
+float j ()
+{
+  _Complex float x = 0;
+  try
+    {
+      x = f ();
+    }
+  catch ( ...)
+    {
+      x += g ();
+    }
+  i (x);
+}
+
index 49165713725ba2d17286d7f5dec1e386b23d2878..af85644bf5771dde38cc0b7d16a8cf367c23409b 100644 (file)
@@ -662,12 +662,16 @@ static void
 update_complex_assignment (gimple_stmt_iterator *gsi, tree r, tree i)
 {
   gimple_stmt_iterator orig_si = *gsi;
+  gimple stmt;
 
   if (gimple_in_ssa_p (cfun))
     update_complex_components (gsi, gsi_stmt (*gsi), r, i);
 
   gimple_assign_set_rhs_with_ops (&orig_si, COMPLEX_EXPR, r, i);
-  update_stmt (gsi_stmt (orig_si));
+  stmt = gsi_stmt (orig_si);
+  update_stmt (stmt);
+  if (maybe_clean_eh_stmt (stmt))
+    gimple_purge_dead_eh_edges (gimple_bb (stmt));
 }
 
 
index 66fee8e2e8cb76745ebb9721631562c7776b2813..217427648638bdf4eb99f770df366f4899399be5 100644 (file)
@@ -2334,6 +2334,11 @@ operation_could_trap_helper_p (enum tree_code op,
        return true;
       return false;
 
+    case COMPLEX_EXPR:
+    case CONSTRUCTOR:
+      /* Constructing an object cannot trap.  */
+      return false;
+
     default:
       /* Any floating arithmetic may trap.  */
       if (fp_operation && flag_trapping_math)