| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fdump-rtl-expand -fno-stack-protector" } */ |
| 3 |
/* { dg-require-effective-target supports_stack_clash_protection } */ |
| 4 |
/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ |
| 5 |
|
| 6 |
int f1 (char *); |
| 7 |
|
| 8 |
int |
| 9 |
f2 (const int size) |
| 10 |
{ |
| 11 |
char buffer[size]; |
| 12 |
return f1 (buffer); |
| 13 |
} |
| 14 |
|
| 15 |
/* So we want to verify that at expand time that we probed the main |
| 16 |
VLA allocation as well as the residuals. Then we want to verify |
| 17 |
there are two probes in the final assembly code. */ |
| 18 |
/* { dg-final { scan-rtl-dump-times "allocation and probing in loop" 1 "expand" } } */ |
| 19 |
/* { dg-final { scan-rtl-dump-times "allocation and probing residuals" 1 "expand" } } */ |
| 20 |
/* { dg-final { scan-assembler-times "or\[ql\]" 2 } } */ |
| 21 |
|
| 22 |
/* We also want to verify (indirectly) that the residual probe is |
| 23 |
guarded. We do that by checking the number of conditional |
| 24 |
branches. There should be 3. One that bypasses the probe loop, one |
| 25 |
in the probe loop and one that bypasses the residual probe. |
| 26 |
|
| 27 |
These will all be equality tests. */ |
| 28 |
/* { dg-final { scan-assembler-times "(\?:je|jne)" 3 } } */ |
| 29 |
|
| 30 |
|