Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / torture / pr81365.C
blobfde5e503df9108348b79b1bc7bcd89188343896b
1 // PR tree-optimization/81365
2 // { dg-do run }
4 struct A { unsigned a; };
6 struct B {
7   B (const A *x)
8   {
9     __builtin_memcpy (b, x, 3 * sizeof (A));
10     __builtin_memcpy (c, x + 3, sizeof (A));
11     __builtin_memset (c + 1, 0, sizeof (A));
12   }
13   bool
14   foo (unsigned x)
15   {
16     A *it = c;
17     if (it->a == x || (++it)->a == x)
18       {
19         A t(b[0]);
20         b[0] = *it;
21         *it = t;
22         return true;
23       }
24     return false;
25   }
26   A b[3];
27   A c[2];
30 int
31 main ()
33   A x[] = { 4, 8, 12, 18 };
34   B y(x);
35   if (!y.foo (18))
36     __builtin_abort ();
37   if (!y.foo (4))
38     __builtin_abort ();