]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/44545 (internal compiler error: in remove_unreachable_handler...
authorRichard Guenther <rguenther@suse.de>
Tue, 16 Nov 2010 13:53:50 +0000 (13:53 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 16 Nov 2010 13:53:50 +0000 (13:53 +0000)
2010-11-16  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/44545
* tree-ssa-reassoc.c (linearize_expr_tree): Possibly throwing
statements are not reassociatable.
(reassociate_bb): Likewise.

* gcc.dg/pr44545.c: New testcase.

From-SVN: r166796

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr44545.c [new file with mode: 0644]
gcc/tree-ssa-reassoc.c

index 2979a97268f4f262176a96e1023429ac094f2a98..302c760e524282e55af688e71dd1bc55a643facc 100644 (file)
@@ -1,3 +1,10 @@
+2010-11-16  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/44545
+       * tree-ssa-reassoc.c (linearize_expr_tree): Possibly throwing
+       statements are not reassociatable.
+       (reassociate_bb): Likewise.
+
 2010-11-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/46491
index cf2f8f1861cda3d55d72669634b93be6e5b7ce39..447f0a1f1fa101a7facaa17b076baf98a0afddfe 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-16  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/44545
+       * gcc.dg/pr44545.c: New testcase.
+
 2010-11-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/46491
diff --git a/gcc/testsuite/gcc.dg/pr44545.c b/gcc/testsuite/gcc.dg/pr44545.c
new file mode 100644 (file)
index 0000000..51983ef
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fnon-call-exceptions -ftrapv -fexceptions" } */
+int
+DrawChunk(int *tabSize, int x) 
+{
+  const int numEnds = 10;
+  int ends[numEnds + 2];
+  if (*tabSize > 0) {
+      x -= 5;
+      x = (x + *tabSize) / *tabSize;
+  }
+}
+
index 5f7c6b721d8e1af5f50a59ed5ad16b1658d9e731..f5cbbcf334aa3107d635648e1671d543689331e2 100644 (file)
@@ -1620,13 +1620,15 @@ linearize_expr_tree (VEC(operand_entry_t, heap) **ops, gimple stmt,
   if (TREE_CODE (binlhs) == SSA_NAME)
     {
       binlhsdef = SSA_NAME_DEF_STMT (binlhs);
-      binlhsisreassoc = is_reassociable_op (binlhsdef, rhscode, loop);
+      binlhsisreassoc = (is_reassociable_op (binlhsdef, rhscode, loop)
+                        && !stmt_could_throw_p (binlhsdef));
     }
 
   if (TREE_CODE (binrhs) == SSA_NAME)
     {
       binrhsdef = SSA_NAME_DEF_STMT (binrhs);
-      binrhsisreassoc = is_reassociable_op (binrhsdef, rhscode, loop);
+      binrhsisreassoc = (is_reassociable_op (binrhsdef, rhscode, loop)
+                        && !stmt_could_throw_p (binrhsdef));
     }
 
   /* If the LHS is not reassociable, but the RHS is, we need to swap
@@ -1815,7 +1817,8 @@ reassociate_bb (basic_block bb)
     {
       gimple stmt = gsi_stmt (gsi);
 
-      if (is_gimple_assign (stmt))
+      if (is_gimple_assign (stmt)
+         && !stmt_could_throw_p (stmt))
        {
          tree lhs, rhs1, rhs2;
          enum tree_code rhs_code = gimple_assign_rhs_code (stmt);