]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/24141 (VRP ICE in compare_name_with_value, at tree-vrp.c...
authorDiego Novillo <dnovillo@redhat.com>
Sat, 1 Oct 2005 14:00:09 +0000 (14:00 +0000)
committerDiego Novillo <dnovillo@gcc.gnu.org>
Sat, 1 Oct 2005 14:00:09 +0000 (10:00 -0400)
PR 24141
* tree-vrp.c (vrp_meet): Clear VR0->EQUIV when building a
non-null range as a last resort.

testsuite/

PR 24141
* gcc.c-torture/execute/pr24141.c: New test.

From-SVN: r104859

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr24141.c [new file with mode: 0644]
gcc/tree-vrp.c

index 95db709fc391b13642ce4cec219f59bc36545ce5..2971178cb4aa57c9ebaf18da9db27ae1feda1396 100644 (file)
@@ -1,3 +1,9 @@
+2005-10-01  Diego Novillo  <dnovillo@redhat.com>
+
+       PR 24141
+       * tree-vrp.c (vrp_meet): Clear VR0->EQUIV when building a
+       non-null range as a last resort.
+
 2005-10-01  James A. Morrison  <phython@gcc.gnu.org>
            Diego Novillo  <dnovillo@redhat.com>
 
index aff2b8d92cb3ab9461413fb4b9ed0678f9fecb19..d90b90b069de4ee5e21f00bb84bb58b3b4cc7280 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-01  Diego Novillo  <dnovillo@redhat.com>
+
+       PR 24141
+       * gcc.c-torture/execute/pr24141.c: New test.
+
 2005-10-01  James A. Morrison  <phython@gcc.gnu.org>
            Diego Novillo  <dnovillo@redhat.com>
 
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr24141.c b/gcc/testsuite/gcc.c-torture/execute/pr24141.c
new file mode 100644 (file)
index 0000000..3012962
--- /dev/null
@@ -0,0 +1,33 @@
+// reduced testcase, compile with -O2. Also, with --disable-checking
+// gcc produces wrong code.
+
+void abort (void);
+int i;
+
+void g (void)
+{
+  i = 1;
+}
+
+void f (int a, int b)
+{
+  int c = 0;
+  if (a == 0)
+    c = 1;
+  if (c)
+    return;
+  if (c == 1)
+    c = 0;
+  if (b == 0)
+    c = 1;
+  if (c)
+    g ();
+}
+
+int main (void)
+{
+  f (1, 0);
+  if (i != 1)
+    abort ();
+  return 0;
+}
index 21e6cf6d1006d495b39fc825be02597c61d01e78..0e5ea09b5d58034e9c1fb409ec0879a72edaebb2 100644 (file)
@@ -3439,7 +3439,14 @@ no_meet:
       && !range_includes_zero_p (vr0)
       && !symbolic_range_p (vr1)
       && !range_includes_zero_p (vr1))
-    set_value_range_to_nonnull (vr0, TREE_TYPE (vr0->min));
+    {
+      set_value_range_to_nonnull (vr0, TREE_TYPE (vr0->min));
+
+      /* Since this meet operation did not result from the meeting of
+        two equivalent names, VR0 cannot have any equivalences.  */
+      if (vr0->equiv)
+       bitmap_clear (vr0->equiv);
+    }
   else
     set_value_range_to_varying (vr0);
 }