OSDN Git Service

Add gcc.dg/pr44838.c.
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Jul 2010 13:40:24 +0000 (13:40 +0000)
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Jul 2010 13:40:24 +0000 (13:40 +0000)
2010-07-08  H.J. Lu  <hongjiu.lu@intel.com>

PR rtl-optimization/44838
* gcc.dg/pr44838.c: New.

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

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

index eb8d5f1..ba11239 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-08  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR rtl-optimization/44838
+       * gcc.dg/pr44838.c: New.
+
 2010-07-08  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/44831
diff --git a/gcc/testsuite/gcc.dg/pr44838.c b/gcc/testsuite/gcc.dg/pr44838.c
new file mode 100644 (file)
index 0000000..61608ed
--- /dev/null
@@ -0,0 +1,33 @@
+/* PR rtl-optimization/44838 */
+/* { dg-do run } */
+/* { dg-options "-O2 -funroll-loops" } */
+
+extern void abort ();
+
+void
+foo (int *a, int n)
+{
+  int *lasta = a + n;
+  for (; a != lasta; a++)
+    {
+      *a *= 2;
+      a[1] = a[-1] + a[-2];
+    }
+}
+
+int a[16];
+int ref[16] = { 0, 1, 4, 2, 10, 12, 24, 44,
+                72, 136, 232, 416, 736, 1296, 2304, 2032 };
+
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 16; i++)
+    a[i] = i;
+  foo (a + 2, 16 - 3);
+  for (i = 0; i < 16; i++)
+    if (ref[i] != a[i])
+      abort ();
+  return 0;
+}