OSDN Git Service

* gcc.dg/tree-ssa/pr21559.c: New test.
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Feb 2006 19:59:34 +0000 (19:59 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Feb 2006 19:59:34 +0000 (19:59 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110713 138bc75d-0d04-0410-961f-82ee72b054a4

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

index e9fb7d1..b0b39a3 100644 (file)
@@ -5,6 +5,8 @@
 
 2006-02-07  Jeff Law  <law@redhat.com>
 
+       * gcc.dg/tree-ssa/pr21559.c: New test.
+
        * gcc.dg/tree-ssa/vrp01.c: Update dumpfile names now that we have
        multiple VRP passes.
        * gcc.dg/tree-ssa/vrp09.c: Likewise.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
new file mode 100644 (file)
index 0000000..6ffcfa1
--- /dev/null
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1-details" } */
+
+static int blocksize = 4096;
+
+int bar (int);
+
+void foo (void)
+{
+  int toread;
+  int bytes;
+  static char eof_reached = 0;
+
+  toread = blocksize;
+  bytes = 1;
+
+  while (toread != 0)
+    {
+      bytes = bar (toread);
+      if (bytes <= 0)
+        {
+          if (bytes < 0)
+            continue;
+          break;
+        }
+      toread -= bytes;
+    }
+
+  if (bytes == 0)
+    eof_reached = 1;
+}
+
+
+/* First, we should simplify the bits < 0 test within the loop.  */
+/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */
+
+/* Second, we should thread the edge out of the loop via the break
+   statement.  */
+/* { dg-final { scan-tree-dump-times "Threaded jump" 1 "vrp1" } } */
+
+/* Now if we were really good, we'd realize that the final bytes == 0
+   test is totally useless.  That's not likely to happen anytime soon.  */
+
+/* { dg-final { cleanup-tree-dump "vrp1" } } */
+