| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O0 -dA -gbtf -mco-re -masm=normal" } */ |
| 3 |
|
| 4 |
struct S { |
| 5 |
int a; |
| 6 |
int b; |
| 7 |
char c; |
| 8 |
}; |
| 9 |
|
| 10 |
union U { |
| 11 |
unsigned int u; |
| 12 |
int i; |
| 13 |
unsigned char uc[4]; |
| 14 |
signed char ic[4]; |
| 15 |
}; |
| 16 |
|
| 17 |
struct S my_s; |
| 18 |
union U my_u; |
| 19 |
|
| 20 |
unsigned long ula[8]; |
| 21 |
|
| 22 |
#define _(x) (__builtin_preserve_access_index (x)) |
| 23 |
|
| 24 |
unsigned long |
| 25 |
func (void) |
| 26 |
{ |
| 27 |
/* 0:1 */ |
| 28 |
int b = _(my_s.b); |
| 29 |
|
| 30 |
/* 0:2 */ |
| 31 |
char c = _(my_s.c); |
| 32 |
|
| 33 |
/* 0:2:3 */ |
| 34 |
unsigned char uc = _(my_u.uc[3]); |
| 35 |
|
| 36 |
/* 0:6 */ |
| 37 |
unsigned long ul = _(ula[6]); |
| 38 |
|
| 39 |
return b + c + uc + ul; |
| 40 |
} |
| 41 |
|
| 42 |
char |
| 43 |
s_ptr (struct S *ps) |
| 44 |
{ |
| 45 |
/* 0:2 */ |
| 46 |
char x = _(ps->c); |
| 47 |
return x; |
| 48 |
} |
| 49 |
|
| 50 |
unsigned char |
| 51 |
u_ptr (union U *pu) |
| 52 |
{ |
| 53 |
/* 0:2:3 */ |
| 54 |
unsigned char x = _(pu->uc[3]); |
| 55 |
return x; |
| 56 |
} |
| 57 |
|
| 58 |
/* { dg-final { scan-assembler-times "ascii \"0:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 59 |
/* { dg-final { scan-assembler-times "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 60 |
/* { dg-final { scan-assembler-times "ascii \"0:2:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 61 |
/* { dg-final { scan-assembler-times "ascii \"0:6.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 62 |
/* { dg-final { scan-assembler-times "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 63 |
/* { dg-final { scan-assembler-times "ascii \"0:2:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 64 |
|
| 65 |
/* { dg-final { scan-assembler-times "bpfcr_type" 6 } } */ |
| 66 |
/* { dg-final { scan-assembler-times "\[\t \]0x6c\[\t \]+\[^\n\]*core_relo_len" 1 } } */ |