| 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 |
int b; |
| 28 |
char c; |
| 29 |
unsigned char uc; |
| 30 |
unsigned long ul; |
| 31 |
int ic; |
| 32 |
|
| 33 |
__builtin_preserve_access_index (({ |
| 34 |
/* 0:1 */ |
| 35 |
b = my_s.b; |
| 36 |
|
| 37 |
/* 0:2 */ |
| 38 |
ic = my_s.c; |
| 39 |
|
| 40 |
/* 0:2:3 */ |
| 41 |
uc = my_u.uc[3]; |
| 42 |
|
| 43 |
/* 0:6 */ |
| 44 |
ul = ula[6]; |
| 45 |
})); |
| 46 |
|
| 47 |
return b + ic + uc + ul; |
| 48 |
} |
| 49 |
|
| 50 |
char |
| 51 |
s_ptr (struct S *ps) |
| 52 |
{ |
| 53 |
/* 0:2 */ |
| 54 |
char x; |
| 55 |
__builtin_preserve_access_index (({ x = ps->c; })); |
| 56 |
return x; |
| 57 |
} |
| 58 |
|
| 59 |
unsigned char |
| 60 |
u_ptr (union U *pu) |
| 61 |
{ |
| 62 |
/* 0:2:3 */ |
| 63 |
unsigned char x; |
| 64 |
__builtin_preserve_access_index (({ x = pu->uc[3]; })); |
| 65 |
return x; |
| 66 |
} |
| 67 |
|
| 68 |
/* { dg-final { scan-assembler-times "ascii \"0:1.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 69 |
/* { dg-final { scan-assembler-times "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 70 |
/* { dg-final { scan-assembler-times "ascii \"0:2:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 71 |
/* { dg-final { scan-assembler-times "ascii \"0:6.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 72 |
/* { dg-final { scan-assembler-times "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 73 |
/* { dg-final { scan-assembler-times "ascii \"0:2:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 74 |
|
| 75 |
/* { dg-final { scan-assembler-times "bpfcr_type" 6 } } */ |
| 76 |
/* { dg-final { scan-assembler-times "\[\t \]0x6c\[\t \]+\[^\n\]*core_relo_len" 1 } } */ |