aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/bpf/core-builtin-2.c
blob: b72e2566b71026f807f029aca3e8a70531333546 (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
/* { dg-do compile } */
/* { dg-options "-O0 -dA -gbtf -mco-re -masm=normal" } */

struct S {
  int a;
  union {
    int _unused;
    int b;
    char c;
  } u[4];
};

struct S foo;

#define _(x) (__builtin_preserve_access_index (x))

void func (void)
{
  char *x = __builtin_preserve_access_index (&foo.u[3].c);

  *x = 's';
}

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