Debian Codegraph @

gcc/testsuite/gcc.dg/pr122572.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-std=c23 -O2" } */
3
4 typedef struct {
5 int *arg;
6 int flags;
7 } optStruct;
8
9 typedef struct {
10 int *specified;
11 int flags;
12 } optEntry;
13
14 typedef struct {
15 int short_allowed;
16 optStruct *opt_table;
17 } optStruct2;
18
19 typedef struct {
20 int short_allowed;
21 optEntry *opt_table;
22 } optStruct3;
23
24 [[gnu::noipa]]
25 void f(int, int, optStruct3 a)
26 {
27 a.opt_table[0].flags = 1;
28 }
29
30 [[gnu::noipa]]
31 int alias_bug (void)
32 {
33 static optEntry option_def[50];
34 static optStruct3 opt;
35 option_def[0].flags = 0;
36 opt.opt_table = option_def;
37 f (0, 0, opt);
38 return opt.opt_table[0].flags;
39 }
40
41 int main()
42 {
43 if (1 != alias_bug())
44 __builtin_abort();
45 }
46