re PR tree-optimization/78558 (Incorrect loop optimization leads to crash)
authorJakub Jelinek <jakub@redhat.com>
Wed, 11 Oct 2017 20:50:46 +0000 (22:50 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 11 Oct 2017 20:50:46 +0000 (22:50 +0200)
PR tree-optimization/78558
* gcc.dg/vect/pr78558.c: New test.

From-SVN: r253661

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

index f1364730db8fa2d3704b1ca51802a92920d49e58..2135f48e5f8fa0e9483c967b405ebe6bf6a75891 100644 (file)
@@ -1,5 +1,8 @@
 2017-10-11  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/78558
+       * gcc.dg/vect/pr78558.c: New test.
+
        PR c++/82414
        * g++.dg/lto/pr82414_0.C: New test.
 
diff --git a/gcc/testsuite/gcc.dg/vect/pr78558.c b/gcc/testsuite/gcc.dg/vect/pr78558.c
new file mode 100644 (file)
index 0000000..2606d4e
--- /dev/null
@@ -0,0 +1,44 @@
+/* PR tree-optimization/78558 */
+
+#include "tree-vect.h"
+
+struct S
+{
+  char p[48];
+  unsigned long long q, r, s;
+} s[50];
+
+struct D
+{
+  unsigned long long q, r;
+} d[50];
+
+void
+foo (void)
+{
+  unsigned long i;
+  for (i = 0; i < 50; ++i)
+    {
+      d[i].q = s[i].q;
+      d[i].r = s[i].r;
+    }
+}
+
+int
+main ()
+{
+  check_vect ();
+  unsigned long i;
+  for (i = 0; i < 50; ++i)
+    {
+      s[i].q = i;
+      s[i].r = 50 * i;
+    }
+  asm volatile ("" : : "g" (s), "g" (d) : "memory");
+  foo ();
+  asm volatile ("" : : "g" (s), "g" (d) : "memory");
+  for (i = 0; i < 50; ++i)
+    if (d[i].q != i || d[i].r != 50 * i)
+      abort ();
+  return 0;
+}