OSDN Git Service

2011-02-10 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Feb 2011 15:28:07 +0000 (15:28 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Feb 2011 15:28:07 +0000 (15:28 +0000)
PR tree-optimization/47677
* tree-vrp.c (vrp_bitmap_equal_p): Fix comparison of empty bitmaps.

* gcc.dg/torture/pr47677.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170002 138bc75d-0d04-0410-961f-82ee72b054a4

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

index f041a02..7b75f48 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-10  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/47677
+       * tree-vrp.c (vrp_bitmap_equal_p): Fix comparison of empty bitmaps.
+
 2011-02-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/47665
index c39034c..649a0b7 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-10  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/47677
+       * gcc.dg/torture/pr47677.c: New testcase.
+
 2011-02-10  Iain Sandoe  <iains@gcc.gnu.org>
 
        * objc.dg/special/load-category-1.m: Remove unused header.
diff --git a/gcc/testsuite/gcc.dg/torture/pr47677.c b/gcc/testsuite/gcc.dg/torture/pr47677.c
new file mode 100644 (file)
index 0000000..bd90778
--- /dev/null
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+
+struct S { int s; int u; };
+extern int bar (void);
+extern struct S *baz (void);
+
+void
+foo (int x, struct S *y, char z, int *v, struct S *s)
+{
+  int c, d;
+  if (x & 2)
+    d = 1;
+  else
+    {
+      d = (x & 1) ? 11 : 0;
+      while ((c = (s->s != (s->u & 1) ? s->s : bar ())) != '\0');
+      c = (s->s != '\\' && (s->u & 4) ? s->s : bar ());
+      if (c == '<')
+        goto lab;
+    }
+  while ((c = ((s->u & 1) ? s->s : bar ())) != 0
+         && ((d != 11 && d != 17) || (v[c] & 1) == 0))
+    {
+    lab:;
+      switch (d)
+        {
+        case 14:
+          if (c == '}')
+            y = baz ();
+          d = y->s = z == '<' ? 17 : 11;
+        }
+    }
+}
+
index b07f121..5e891f5 100644 (file)
@@ -714,6 +714,8 @@ static inline bool
 vrp_bitmap_equal_p (const_bitmap b1, const_bitmap b2)
 {
   return (b1 == b2
+         || ((!b1 || bitmap_empty_p (b1))
+             && (!b2 || bitmap_empty_p (b2)))
          || (b1 && b2
              && bitmap_equal_p (b1, b2)));
 }