Debian Codegraph @

gcc/testsuite/gcc.target/bpf/core-attr-6.c

raw
1 /* Test for BPF CO-RE __attribute__((preserve_access_index)) with accesses on
2 LHS and both LHS and RHS of assignment. */
3
4 /* { dg-do compile } */
5 /* { dg-options "-O2 -dA -gbtf -mco-re -masm=normal" } */
6
7 struct U {
8 int c;
9 struct V {
10 int d;
11 int e[4];
12 int f;
13 int *g;
14 } v;
15 } u;
16
17 struct T {
18 int a;
19 int b;
20 struct U u;
21 struct U *ptr_u;
22 struct U *array_u;
23 } __attribute__((preserve_access_index));
24
25 extern void mset(void *);
26
27 void
28 func (struct T *t, int i)
29 {
30 /* 0:3 0:1:1:1 */
31 t->ptr_u->v.e[1] = 0xb1;
32
33 /* 0:3 0:1:2 */
34 mset (&(t->ptr_u->v.f));
35
36 /* 0:0 */
37 mset (&t->a);
38 }
39
40 /* { dg-final { scan-assembler-times "ascii \"0:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
41 /* { dg-final { scan-assembler-times "ascii \"0:1:1:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
42 /* { dg-final { scan-assembler-times "ascii \"0:1:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
43 /* { dg-final { scan-assembler-times "ascii \"0:0.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
44 /* { dg-final { scan-assembler-times "bpfcr_astr_off \\(\"0:1:1:1\"\\)" 1 } } */
45 /* { dg-final { scan-assembler-times "bpfcr_astr_off \\(\"0:3\"\\)" 2 } } */
46 /* { dg-final { scan-assembler-times "bpfcr_astr_off \\(\"0:1:2\"\\)" 1 } } */
47 /* { dg-final { scan-assembler-times "bpfcr_astr_off \\(\"0:0\"\\)" 1 } } */
48 /* { dg-final { scan-assembler-times "bpfcr_type \\(struct T\\)" 3 } } */
49 /* { dg-final { scan-assembler-times "bpfcr_type \\(struct U\\)" 2 } } */
50