aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/bpf/core-builtin-exprlist-2.c
blob: e8ae4c82e21c0b35837cbe4183c4d4a3d1b60df9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* { dg-do compile } */
/* { dg-options "-O0 -dA -gbtf -mco-re -masm=normal" } */

struct T {
  int a;
  int b;
  struct U {
    int c;
    struct V {
      int d;
      int e[4];
      int f;
    } v;
  } u;
};

void func (struct T * foo)
{
  /* Access string: "0:2:1:1:3" */
  int *x;
  int *y;
  __builtin_preserve_access_index (({
    x =  &(foo->u.v.e[3]);
    struct U *tmp = &(foo->u);
    y =  &(tmp->v.f);
  }));

  *x = 17;
  *y = 16;
}

/* { dg-final { scan-assembler-times "ascii \"0:2:1:1:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
/* { dg-final { scan-assembler-times "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
/* { dg-final { scan-assembler-times "ascii \"0:1:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
/* { dg-final { scan-assembler-times "bpfcr_type" 3 } } */