| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fomit-frame-pointer -mnoreturn-no-callee-saved-registers" } */ |
| 3 |
/* { dg-require-effective-target supports_stack_clash_protection } */ |
| 4 |
/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
int x0, x1; |
| 9 |
void f1 (void); |
| 10 |
void f2 (int, int); |
| 11 |
|
| 12 |
__attribute__ ((noreturn)) |
| 13 |
void |
| 14 |
f3 (void) |
| 15 |
{ |
| 16 |
int y0 = x0; |
| 17 |
int y1 = x1; |
| 18 |
f1 (); |
| 19 |
f2 (y0, y1); |
| 20 |
while (1); |
| 21 |
} |
| 22 |
|
| 23 |
/* Verify no explicit probes. */ |
| 24 |
/* { dg-final { scan-assembler-not "or\[ql\]" } } */ |
| 25 |
|
| 26 |
/* y0/y1 are live across the call and thus must be allocated |
| 27 |
into either a stack slot or callee saved register. The former |
| 28 |
would be rather dumb. So assume it does not happen. |
| 29 |
|
| 30 |
So search for a push/pop sequence for stack probe and 2 argument |
| 31 |
pushes on ia32. There is no need to save and restore the PIC |
| 32 |
register on ia32 for a noreturn function. */ |
| 33 |
/* { dg-final { scan-assembler-times "push\[ql\]" 1 { target { ! ia32 } } } } */ |
| 34 |
/* { dg-final { scan-assembler-times "push\[ql\]" 3 { target ia32 } } } */ |
| 35 |
/* { dg-final { scan-assembler-not "pop" { target { ! ia32 } } } } */ |
| 36 |
/* { dg-final { scan-assembler-times "pop" 1 { target ia32 } } } */ |