* config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): New.
[official-gcc.git] / gcc / testsuite / gcc.dg / stack-check-6.c
blobad2021c903719590f6de2774b80f76914eb94378
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 } */
6 extern void foo (char *);
7 extern void bar (void);
10 /* This is a leaf with a frame that is large enough to require probing with
11 a residual allocation, but small enough to probe inline. */
12 void
13 f4 (void)
15 char buf[4096 + 512];
16 asm volatile ("" : : "g" (&buf) : "memory");
20 /* This is a non-leaf with a frame large enough to require probing and
21 a residual allocation, but small enough to probe inline. */
22 void
23 f5 (void)
25 char buf[4096 + 512];
26 foo (buf);
29 /* This is a leaf with a frame that is large enough to require probing with
30 a loop plus a residual allocation. */
31 void
32 f6 (void)
34 char buf[4096 * 10 + 512];
35 asm volatile ("" : : "g" (&buf) : "memory");
39 /* This is a non-leaf with a frame large enough to require probing with
40 a loop plus a residual allocation. */
41 void
42 f7 (void)
44 char buf[4096 * 10 + 512];
45 foo (buf);
48 /* { dg-final { scan-rtl-dump-times "Stack clash inline probes" 2 "pro_and_epilogue" } } */
49 /* { dg-final { scan-rtl-dump-times "Stack clash probe loop" 2 "pro_and_epilogue" } } */
50 /* { dg-final { scan-rtl-dump-times "Stack clash residual allocation in prologue" 4 "pro_and_epilogue" } } */
51 /* { dg-final { scan-rtl-dump-times "Stack clash not noreturn" 4 "pro_and_epilogue" } } */
53 /* { dg-final { scan-rtl-dump-times "Stack clash no frame pointer needed" 4 "pro_and_epilogue" { target { ! frame_pointer_for_non_leaf } } } } */
54 /* { dg-final { scan-rtl-dump-times "Stack clash no frame pointer needed" 2 "pro_and_epilogue" { target { frame_pointer_for_non_leaf } } } } */
55 /* { dg-final { scan-rtl-dump-times "Stack clash frame pointer needed" 2 "pro_and_epilogue" { target { frame_pointer_for_non_leaf } } } } */