re PR middle-end/35400 (-Wtype-limits -O2 causes ICE tree check: expected ssa_name...
authorRichard Guenther <rguenther@suse.de>
Sun, 6 Apr 2008 21:20:49 +0000 (21:20 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 6 Apr 2008 21:20:49 +0000 (21:20 +0000)
2008-04-06  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/35400
* tree-vrp.c (vrp_evaluate_conditional): Only query value-range
information from SSA_NAMEs.

* gcc.dg/torture/pr35400.c: New testcase.
* g++.dg/torture/pr35400.C: Likewise.

From-SVN: r133967

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr35400.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr35400.c [new file with mode: 0644]
gcc/tree-vrp.c

index da2f5a7cdf857eb14f9e752da4543a2e05e14dc0..921982ecbb4414677852e5899e7cc4b1f91b7acd 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-06  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/35400
+       * tree-vrp.c (vrp_evaluate_conditional): Only query value-range
+       information from SSA_NAMEs.
+
 2008-04-06  Anatoly Sokolov <aesok@post.ru>
 
        * config/avr/avr.h (avr_mega_p): Remove declaration.
index b5b21556f043b235c707f6a5ba9bf12ec295434c..beac0eb46d6973a3173809870474837e6f2854cb 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-06  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/35400
+       * gcc.dg/torture/pr35400.c: New testcase.
+       * g++.dg/torture/pr35400.C: Likewise.
+
 2008-04-06  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/35780
diff --git a/gcc/testsuite/g++.dg/torture/pr35400.C b/gcc/testsuite/g++.dg/torture/pr35400.C
new file mode 100644 (file)
index 0000000..021135d
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-Wtype-limits" } */
+
+struct A
+{
+  A();
+  ~A();
+};
+
+void foo()
+{
+  A x[1];
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr35400.c b/gcc/testsuite/gcc.dg/torture/pr35400.c
new file mode 100644 (file)
index 0000000..285dc72
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-Wtype-limits" } */
+
+struct A
+{
+  struct A *p;
+};
+
+int foo(const struct A *q)
+{
+  return q->p == q;
+}
+
+void bar(int);
+
+void baz()
+{
+  struct A a;
+
+  while (foo(&a))
+    bar(foo(&a));
+}
index 9741262dba23c4eda570bae2038d0da10a0761dd..273b5fdfdc07c3b3794c8110e2daa74690d8ae05 100644 (file)
@@ -5385,7 +5385,8 @@ vrp_evaluate_conditional (tree cond, tree stmt)
 
   if (warn_type_limits
       && ret
-      && TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison)
+      && TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison
+      && TREE_CODE (TREE_OPERAND (cond, 0)) == SSA_NAME)
     {
       /* If the comparison is being folded and the operand on the LHS
         is being compared against a constant value that is outside of