Debian Codegraph @

gcc/testsuite/gcc.dg/c23-tag-alias-7.c

raw
1 /* { dg-do run }
2 * { dg-options "-std=gnu23 -O2" }
3 */
4
5
6 /* This test fails when the bitfield is not marked
7 nonaddressable in the composite type. */
8
9 struct foo { int x :3; } x;
10
11 [[gnu::noinline,gnu::noipa]]
12 int test_foo1(struct foo* a, void* b)
13 {
14 a->x = 1;
15
16 struct foo { int x :3; } y;
17 typeof(*(1 ? &x : &y)) *z = b;
18
19 z->x = 2;
20
21 return a->x;
22 }
23
24 int main()
25 {
26 struct foo y;
27
28 if (2 != test_foo1(&y, &y))
29 __builtin_abort();
30
31 return 0;
32 }
33
34