From: Jakub Jelinek Date: Wed, 11 Oct 2017 20:50:46 +0000 (+0200) Subject: re PR tree-optimization/78558 (Incorrect loop optimization leads to crash) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=69c328ec60f2ff1858387eaf195119f6976fe99c;p=gcc.git re PR tree-optimization/78558 (Incorrect loop optimization leads to crash) PR tree-optimization/78558 * gcc.dg/vect/pr78558.c: New test. From-SVN: r253661 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f1364730db8..2135f48e5f8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2017-10-11 Jakub Jelinek + 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 index 00000000000..2606d4ec10d --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr78558.c @@ -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; +}