Debian Codegraph @

gcc/testsuite/gcc.dg/pr93210.c

raw
1 /* PR tree-optimization/93210 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 /* { dg-final { scan-tree-dump-times "(?:return|<retval> =) \[0-9]\[0-9a-fA-FxX]*;" 31 "optimized" } } */
5
6 #ifdef __SIZEOF_INT128__
7 typedef unsigned __int128 L;
8 #else
9 typedef unsigned long long L;
10 #endif
11 struct S { signed char a, b; unsigned char c; };
12 struct T { signed char d; struct S e[25]; signed char f; };
13 union U { struct T g; L h[10]; };
14 const union U u = { { 1, { { 2, 3, 4 }, { 5, 6, 7 }, { 8, 9, 10 },
15 { 12, 13, 14 }, { 15, 16, 17 }, { 18, 19, 20 },
16 { 22, 23, 24 }, { 25, 26, 27 }, { 28, 29, 30 },
17 { 32, 33, 34 }, { 35, 36, 37 }, { 38, 39, 40 },
18 { 42, 43, 44 }, { 45, 46, 47 }, { 48, 49, 50 },
19 { 52, 53, 54 }, { 55, 56, 57 }, { 58, 59, 60 },
20 { 62, 63, 64 }, { 65, 66, 67 }, { 68, 69, 70 },
21 { 72, 73, 74 }, { 75, 76, 77 }, { 78, 79, 80 },
22 { 82, 83, 84 } }, 85 } };
23 const union U v = { { 1, { { 2, 3, 4 }, [1 ... 23] = { 5, 6, 7 },
24 { 8, 9, 10 } }, 86 } };
25 struct A { char a[5]; char b[16]; char c[7]; };
26 union V { struct A d; unsigned int e[10]; };
27 const union V w = { { "abcde", "ijkl", "mnopqr" } };
28 #define N(n) __attribute__((noipa)) L foo##n (void) { return u.h[n]; }
29 #define M N(0) N(1) N(2) N(3) N(4) N(5) N(6) N(7) N(8) N(9)
30 M
31 #undef N
32 #define N(n) __attribute__((noipa)) L bar##n (void) { return v.h[n]; }
33 M
34 #undef N
35 #define N(n) __attribute__((noipa)) L baz##n (void) { return w.e[n]; }
36 M
37
38 typedef L (*F) (void);
39 F arr[30] = {
40 #undef N
41 #define N(n) foo##n,
42 M
43 #undef N
44 #define N(n) bar##n,
45 M
46 #undef N
47 #define N(n) baz##n,
48 M
49 };
50
51 int
52 main ()
53 {
54 const union U *p = &u;
55 const union U *q = &v;
56 const union V *r = &w;
57 __asm ("" : "+g" (p));
58 __asm ("" : "+g" (q));
59 __asm ("" : "+g" (r));
60 for (int i = 0; i < 10; i++)
61 if (arr[i] () != p->h[i]
62 || arr[i + 10] () != q->h[i]
63 || arr[i + 20] () != r->e[i])
64 __builtin_abort ();
65 return 0;
66 }