c++: Implement for namespace statics CWG 2867 - Order of initialization for structure...
[official-gcc.git] / gcc / testsuite / gcc.dg / pr111683-2.c
blob6861d157e55f38671ad79c45139e98f6c98fff18
1 /* PR middle-end/111683 */
2 /* { dg-do run } */
3 /* { dg-options "-O2" } */
5 int b[6] = { 3, 4, 5, 6, 7, 8 }, c[12];
6 int d[16] = { 0, 1, 3, 6, 10, 14, 12, 9, 5, 0, 0, 0 };
8 int
9 main ()
11 int i;
12 if (sizeof (int) * 2 != sizeof (long long))
13 return 0;
14 for (i = 0; i < 6; i++)
16 long long a;
17 __builtin_memcpy (&a, &c[i], sizeof (a));
18 a += (((long long) i) << (sizeof (int) * __CHAR_BIT__)) + i;
19 __builtin_memcpy (&c[i], &a, sizeof (a));
20 __builtin_memcpy (&a, &c[i + 2], sizeof (a));
21 a += (((long long) i) << (sizeof (int) * __CHAR_BIT__)) + i;
22 __builtin_memcpy (&c[i + 2], &a, sizeof (a));
24 if (__builtin_memcmp (&c[0], &d[0], sizeof (c)))
25 __builtin_abort ();
26 return 0;