| 1 |
/* { dg-options " -O -fstack-protector-strong -mstack-protector-guard=sysreg -mstack-protector-guard-reg=tpidr2_el0 -mstack-protector-guard-offset=16" } */ |
| 2 |
/* { dg-final { check-function-bodies "**" "" } } */ |
| 3 |
|
| 4 |
void g(void *); |
| 5 |
__SVBool_t *h(void *); |
| 6 |
|
| 7 |
/* |
| 8 |
** test1: |
| 9 |
** sub sp, sp, #288 |
| 10 |
** stp x29, x30, \[sp, #?272\] |
| 11 |
** add x29, sp, #?272 |
| 12 |
** mrs (x[0-9]+), tpidr2_el0 |
| 13 |
** ldr (x[0-9]+), \[\1, #?16\] |
| 14 |
** str \2, \[sp, #?264\] |
| 15 |
** mov \2, #?0 |
| 16 |
** add x0, sp, #?8 |
| 17 |
** bl g |
| 18 |
** ... |
| 19 |
** mrs .* |
| 20 |
** ... |
| 21 |
** bne .* |
| 22 |
** ... |
| 23 |
** ldp x29, x30, \[sp, #?272\] |
| 24 |
** add sp, sp, #?288 |
| 25 |
** ret |
| 26 |
** bl __stack_chk_fail |
| 27 |
*/ |
| 28 |
int test1() { |
| 29 |
int y[0x40]; |
| 30 |
g(y); |
| 31 |
return 1; |
| 32 |
} |
| 33 |
|
| 34 |
/* |
| 35 |
** test2: |
| 36 |
** stp x29, x30, \[sp, #?-16\]! |
| 37 |
** mov x29, sp |
| 38 |
** sub sp, sp, #1040 |
| 39 |
** mrs (x[0-9]+), tpidr2_el0 |
| 40 |
** ldr (x[0-9]+), \[\1, #?16\] |
| 41 |
** str \2, \[sp, #?1032\] |
| 42 |
** mov \2, #?0 |
| 43 |
** add x0, sp, #?8 |
| 44 |
** bl g |
| 45 |
** ... |
| 46 |
** mrs .* |
| 47 |
** ... |
| 48 |
** bne .* |
| 49 |
** ... |
| 50 |
** add sp, sp, #?1040 |
| 51 |
** ldp x29, x30, \[sp\], #?16 |
| 52 |
** ret |
| 53 |
** bl __stack_chk_fail |
| 54 |
*/ |
| 55 |
int test2() { |
| 56 |
int y[0x100]; |
| 57 |
g(y); |
| 58 |
return 1; |
| 59 |
} |
| 60 |
|
| 61 |
#pragma GCC target "+sve" |
| 62 |
|
| 63 |
/* |
| 64 |
** test3: |
| 65 |
** stp x29, x30, \[sp, #?-16\]! |
| 66 |
** mov x29, sp |
| 67 |
** addvl sp, sp, #-18 |
| 68 |
** ... |
| 69 |
** str p4, \[sp\] |
| 70 |
** ... |
| 71 |
** sub sp, sp, #272 |
| 72 |
** mrs (x[0-9]+), tpidr2_el0 |
| 73 |
** ldr (x[0-9]+), \[\1, #?16\] |
| 74 |
** str \2, \[sp, #?264\] |
| 75 |
** mov \2, #?0 |
| 76 |
** add x0, sp, #?8 |
| 77 |
** bl h |
| 78 |
** ... |
| 79 |
** mrs .* |
| 80 |
** ... |
| 81 |
** bne .* |
| 82 |
** ... |
| 83 |
** add sp, sp, #?272 |
| 84 |
** ... |
| 85 |
** ldr p4, \[sp\] |
| 86 |
** ... |
| 87 |
** addvl sp, sp, #18 |
| 88 |
** ldp x29, x30, \[sp\], #?16 |
| 89 |
** ret |
| 90 |
** bl __stack_chk_fail |
| 91 |
*/ |
| 92 |
__SVBool_t test3() { |
| 93 |
int y[0x40]; |
| 94 |
return *h(y); |
| 95 |
} |