1 /* { dg-do run } */
2 /* { dg-options "-O -fdump-tree-esra-details" } */
3 
4 volatile short vs;
5 volatile long vl;
6 
7 struct A { short s; long i; long j; };
8 struct A a, b;
foo()9 void foo ()
10 {
11   struct A c;
12   __builtin_memcpy (&c, &b, sizeof (struct A));
13   __builtin_memcpy (&a, &c, sizeof (struct A));
14 
15   vs = c.s;
16   vl = c.i;
17   vl = c.j;
18 }
19 
20 
main()21 int main()
22 {
23   if ((sizeof (short) != 2)
24       || (__builtin_offsetof (struct A, i) < 4))
25     return 0;
26 
27   __builtin_memset (&b, 0, sizeof (struct A));
28   b.s = 1;
29   __builtin_memcpy ((char *)&b+2, &b, 2);
30   foo ();
31   __builtin_memcpy (&a, (char *)&a+2, 2);
32   if (a.s != 1)
33     __builtin_abort ();
34   return 0;
35 }
36 
37 /* { dg-final { scan-tree-dump-not "Will attempt to totally scalarize" "esra" } } */
38