re PR tree-optimization/21921 (internal compiler error: in tsi_link_before, at tree...
authorPaolo Bonzini <bonzini@gnu.org>
Wed, 13 Jul 2005 14:42:16 +0000 (14:42 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Wed, 13 Jul 2005 14:42:16 +0000 (14:42 +0000)
ChangeLog:
2005-07-13  Paolo Bonzini  <bonzini@gnu.org>

PR tree-optimization/21921
* tree-iterator.c (tsi_link_before): Support the case when
tsi_end_p (tsi) == true.

testsuite/ChangeLog:
2005-07-13  Paolo Bonzini  <bonzini@gnu.org>

PR tree-optimization/21921
* gcc.dg/tree-ssa/pr21921.c: New.

From-SVN: r101970

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr21921.c [new file with mode: 0644]
gcc/tree-iterator.c

index dd21fc9f55b155fba55732f5c7149666e8790960..b5adb7df15512947afaabf6cb47ae9b4c44eaad6 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-13  Paolo Bonzini  <bonzini@gnu.org>
+
+       PR tree-optimization/21921
+       * tree-iterator.c (tsi_link_before): Support the case when
+       tsi_end_p (tsi) == true.
+
 2005-07-12  Zdenek Dvorak  <dvorakz@suse.cz>
 
        PR tree-optimization/22442
index a2c26cee14e8194ef7677ca75c5ab2d1469f9a91..ebc793e978d5050c2436d8cb62ee317389da9c8d 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-13  Paolo Bonzini  <bonzini@gnu.org>
+
+       PR tree-optimization/21921
+       * gcc.dg/tree-ssa/pr21921.c: New.
+
 2005-07-12  Zdenek Dvorak  <dvorakz@suse.cz>
 
        PR tree-optimizatio/22442
diff --git a/gcc/testsuite/gcc.dg/pr21921.c b/gcc/testsuite/gcc.dg/pr21921.c
new file mode 100644 (file)
index 0000000..d6a8a2a
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -funsafe-math-optimizations" } */
+
+void
+Q (double *s, double h)
+{
+  int i;
+  if (h > 1)
+    h = h - 1;
+
+  for (i = 1; i < 3; i++)
+    if (s[i] / h > 0)
+      s[0] = h, s[i] = s[i] / h;
+}
index 7913bdad7c8e890f45e093898af943787aa26a7f..3c2acd38ea7a698d923b87542856c633d01a5b45 100644 (file)
@@ -110,8 +110,11 @@ tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
     }
   else
     {
-      gcc_assert (!STATEMENT_LIST_TAIL (i->container));
-      STATEMENT_LIST_HEAD (i->container) = head;
+      head->prev = STATEMENT_LIST_TAIL (i->container);
+      if (head->prev)
+       head->prev->next = head;
+      else
+       STATEMENT_LIST_HEAD (i->container) = head;
       STATEMENT_LIST_TAIL (i->container) = tail;
     }
 
@@ -127,7 +130,6 @@ tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode)
       i->ptr = tail;
       break;
     case TSI_SAME_STMT:
-      gcc_assert (cur);
       break;
     }
 }