1 /* Basic test for union __attribute__((preserve_access_index))
2 for BPF CO-RE support. */
3
4 /* { dg-do compile } */
5 /* { dg-options "-O0 -dA -gbtf -mco-re" } */
6
7 union U {
8 int a;
9 char c;
10 } __attribute__((preserve_access_index));
11
12 void
13 func (union U *u)
14 {
15 /* 0:1 */
16 char *c = &(u->c);
17 *c = 'c';
18 }
19
20 /* { dg-final { scan-assembler-times "ascii \"0:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
21 /* { dg-final { scan-assembler-times "bpfcr_type" 1 } } */