Debian Codegraph @

gcc/testsuite/gcc.dg/gnu23-tag-alias-1.c

raw
1 /* { dg-do run }
2 * { dg-options "-std=gnu23 -O2" }
3 */
4
5 /* Check that structs with flexible array member can alias. */
6
7 struct bar { int x; int f[]; };
8
9 [[gnu::noinline,gnu::noipa]]
10 int test_bar2(struct bar* a, void* b)
11 {
12 a->x = 1;
13
14 struct bar { int x; int f[0]; }* p = b;
15 struct bar* q = a;
16 p->x = 2;
17
18 return a->x;
19 }
20
21
22
23 int main()
24 {
25 struct bar z;
26
27 if (2 != test_bar2(&z, &z))
28 __builtin_abort();
29
30 return 0;
31 }
32
33