Add a testcase for PR tree-optimization/67077
authorH.J. Lu <hongjiu.lu@intel.com>
Mon, 3 Aug 2015 16:58:03 +0000 (16:58 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Mon, 3 Aug 2015 16:58:03 +0000 (09:58 -0700)
PR tree-optimization/67077
* gcc.dg/pr67077.c: New test.

From-SVN: r226518

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr67077.c [new file with mode: 0644]

index 0a841b5139834963e4d89f81786995f0aefbb82e..44d7eb9588299713ebb0f64a7b7ecb7fc04a37f4 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR tree-optimization/67077
+       * gcc.dg/pr67077.c: New test.
+
 2015-08-03  Jeff Law  <law@redhat.com>
 
        PR middle-end/66314
diff --git a/gcc/testsuite/gcc.dg/pr67077.c b/gcc/testsuite/gcc.dg/pr67077.c
new file mode 100644 (file)
index 0000000..555b1e3
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall -O2" } */
+
+unsigned char buffer[8];
+unsigned long
+foo (void)
+{
+  unsigned long i;
+  i = buffer[0];
+  if (i >= 8)
+    return i - 7;
+  i++;
+  while (i > 8)
+    {
+      if (buffer[i-1] != 0)
+        return 0;
+      i--;
+    }
+  return 1;
+}