Debian Codegraph @

gcc/testsuite/gcc.dg/torture/pr106590.c

raw
1 /* PR rtl-optimization/106590 } */
2 /* { dg-do run } */
3 /* { dg-additional-options "-mtune=skylake" { target { i?86-*-* x86_64-*-* } } } */
4
5 typedef struct A { short a; } A;
6 typedef A *B;
7 typedef struct C { int c, d; } C;
8 typedef C *D;
9
10 B
11 foo (void)
12 {
13 static A r = { .a = 1 };
14 return &r;
15 }
16
17 D
18 bar (void)
19 {
20 static C r = { .c = 1, .d = 23 };
21 return &r;
22 }
23
24 static inline int __attribute__((always_inline))
25 baz (short a)
26 {
27 int e = 1, f;
28 short g;
29 D h;
30
31 switch (a)
32 {
33 case 1:
34 f = 23;
35 g = 1;
36 break;
37 case 2:
38 f = 20;
39 g = 2;
40 break;
41 }
42
43 h = bar ();
44
45 if (h->d != f || h->c != g)
46 __builtin_abort ();
47 return e;
48 }
49
50 int
51 qux (void)
52 {
53 B i = foo ();
54 int e = 1;
55
56 switch (i->a)
57 {
58 case 1:
59 case 2:
60 e = baz (i->a);
61 break;
62 case 3:
63 e = 0;
64 break;
65 }
66
67 return e;
68 }
69
70 int
71 main ()
72 {
73 qux ();
74 return 0;
75 }