Debian Codegraph @

gcc/testsuite/gcc.dg/lto/pr113359-1_0.c

raw
1 /* { dg-lto-do run } */
2 /* { dg-require-effective-target lp64 } */
3 /* { dg-lto-options {{-O2 -flto -fno-strict-aliasing -fno-ipa-cp --disable-tree-esra }} } */
4
5 #define CI 0xdeadbeef
6 #define CL1 0xdeaddead1234beef
7 #define CL2 0xdead1234deadbeef
8
9 struct SA
10 {
11 unsigned int ax;
12 unsigned long ay;
13 unsigned long az;
14 };
15
16 struct SB
17 {
18 unsigned long bx;
19 unsigned int by;
20 unsigned long bz;
21 };
22
23 struct ZA
24 {
25 int p;
26 struct SA s;
27 short q;
28 };
29
30 struct ZB
31 {
32 int p;
33 struct SB s;
34 short q;
35 };
36
37 void __attribute__((noinline))
38 geta (struct SA *d, struct ZA *p)
39 {
40 struct SA tmp = p->s;
41 *d = tmp;
42 }
43
44 void getb (struct SB *d, struct ZB *p);
45
46 struct ZA ga;
47 struct ZB gb;
48
49 void __attribute__((noipa))
50 init (void)
51 {
52 ga.s.ax = CI;
53 ga.s.ay = CL1;
54 ga.s.az = CL2;
55
56 gb.s.bx = CL1;
57 gb.s.by = CI;
58 gb.s.bz = CL2;
59 }
60
61 int
62 main (int argc, char **argv)
63 {
64 init();
65 struct SA a;
66 geta (&a, &ga);
67
68 if (a.ax != CI)
69 __builtin_abort ();
70 if (a.ay != CL1)
71 __builtin_abort ();
72 if (a.az != CL2)
73 __builtin_abort ();
74
75 struct SB b;
76 getb (&b, &gb);
77
78 if (b.bx != CL1)
79 __builtin_abort ();
80 if (b.by != CI)
81 __builtin_abort ();
82 if (b.bz != CL2)
83 __builtin_abort ();
84
85 return 0;
86 }