111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */
|
|
3 /* { dg-require-effective-target supports_stack_clash_protection } */
|
|
4
|
|
5 int f (int *);
|
|
6
|
|
7 int
|
|
8 g (int a)
|
|
9 {
|
|
10 return f (&a);
|
|
11 }
|
|
12
|
|
13 int f1 (void);
|
|
14 int f2 (int);
|
|
15
|
|
16 int
|
|
17 f3 (void)
|
|
18 {
|
|
19 return f2 (f1 ());
|
|
20 }
|
|
21
|
|
22
|
|
23 /* If we have caller implicit probes, then we should not need probes in either callee.
|
|
24 Else callees may need probes, particularly if non-leaf functions require a
|
|
25 frame/frame pointer. */
|
|
26 /* { dg-final { scan-rtl-dump-times "Stack clash no probe" 2 "pro_and_epilogue" { target caller_implicit_probes } } } */
|
|
27 /* { dg-final { scan-rtl-dump-times "Stack clash inline probe" 1 "pro_and_epilogue" { target { ! caller_implicit_probes } } } } */
|
|
28 /* { dg-final { scan-rtl-dump-times "Stack clash no probe" 1 "pro_and_epilogue" { target { ! caller_implicit_probes } } } } */
|
|
29
|
|
30 /* Neither of these functions are a nonreturn function. */
|
|
31 /* { dg-final { scan-rtl-dump-times "Stack clash not noreturn" 2 "pro_and_epilogue" } } */
|
|
32
|
|
33 /* If the callee realigns the stack or has a mandatory frame, then both functions
|
|
34 have a residual allocation. Else just g() has a residual allocation. */
|
|
35 /* { dg-final { scan-rtl-dump-times "Stack clash residual allocation in prologue" 2 "pro_and_epilogue" } } */
|
|
36
|
|
37
|
|
38 /* If the target has frame pointers for non-leafs, then both functions will
|
|
39 need a frame pointer. Otherwise neither should. */
|
|
40 /* { dg-final { scan-rtl-dump-times "Stack clash no frame pointer needed" 2 "pro_and_epilogue" { target { ! frame_pointer_for_non_leaf } } } } */
|
|
41 /* { dg-final { scan-rtl-dump-times "Stack clash frame pointer needed" 2 "pro_and_epilogue" { target { frame_pointer_for_non_leaf } } } } */
|