re PR middle-end/23960 (ICE in compare_values in VRP)
authorKazu Hirata <kazu@codesourcery.com>
Mon, 26 Sep 2005 01:28:50 +0000 (01:28 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Mon, 26 Sep 2005 01:28:50 +0000 (01:28 +0000)
gcc/
PR tree-optimization/23960
* fold-const.c (fold_binary): Use op0 and op1 instead of arg0
and arg1 if we are passing them to fold_build2.

gcc/testsuite/
PR tree-optimization/23960
* gcc.c-torture/compile/pr23960.c: New.

From-SVN: r104634

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr23960.c [new file with mode: 0644]

index d64329774a8307fc7754432042a68d0be53f0689..44cb1b0bb5788d4b86981b5399c17def23ab6b58 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-25  Kazu Hirata  <kazu@codesourcery.com>
+
+       * fold-const.c (fold_binary): Use op0 and op1 instead of arg0
+       and arg1 if we are passing them to fold_build2.
+
 2005-09-25  Dan Nicolaescu  <dann@ics.uci.edu>
 
        PR 23828
index 4b41adfc59f988cf1776120f5bdcd0888bf901e6..0190c322dc59feeb717cc4e4849551f031aa1f6f 100644 (file)
@@ -9285,7 +9285,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
                  return omit_one_operand (type, integer_one_node, arg0);
 
                case GT_EXPR:
-                 return fold_build2 (NE_EXPR, type, arg0, arg1);
+                 return fold_build2 (NE_EXPR, type, op0, op1);
 
                default:
                  break;
index 0c43597323e8c569fbeca749df3a59e9c2064af5..2749585def4d963b4be3065846815b0347c7dca7 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-25  Kazu Hirata  <kazu@codesourcery.com>
+
+       PR tree-optimization/23960
+       * gcc.c-torture/compile/pr23960.c: New.
+
 2005-09-23  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/16861
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23960.c b/gcc/testsuite/gcc.c-torture/compile/pr23960.c
new file mode 100644 (file)
index 0000000..5ca0562
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR tree-optimization/23960
+   fold-const.c used to construct a comparison node with one pointer
+   operand and one non-pointer operand.  */
+
+void abort (void) __attribute__ ((noreturn));
+
+void
+foo (char *d, unsigned long int n)
+{ 
+  if (d + n > d)
+    abort ();
+}