* gcc.dg/stack-check-5.c: Skip with -fstack-protector.
[official-gcc.git] / gcc / testsuite / gcc.dg / stack-check-6.c
blobab4b0e8894c34551c223c4fcf809a5d150775e17
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 /* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */
7 extern void foo (char *);
8 extern void bar (void);
11 /* This is a leaf with a frame that is large enough to require probing with
12 a residual allocation, but small enough to probe inline. */
13 void
14 f4 (void)
16 char buf[4096 + 512];
17 asm volatile ("" : : "g" (&buf) : "memory");
21 /* This is a non-leaf with a frame large enough to require probing and
22 a residual allocation, but small enough to probe inline. */
23 void
24 f5 (void)
26 char buf[4096 + 512];
27 foo (buf);
30 /* This is a leaf with a frame that is large enough to require probing with
31 a loop plus a residual allocation. */
32 void
33 f6 (void)
35 char buf[4096 * 10 + 512];
36 asm volatile ("" : : "g" (&buf) : "memory");
40 /* This is a non-leaf with a frame large enough to require probing with
41 a loop plus a residual allocation. */
42 void
43 f7 (void)
45 char buf[4096 * 10 + 512];
46 foo (buf);
49 /* { dg-final { scan-rtl-dump-times "Stack clash inline probes" 2 "pro_and_epilogue" } } */
50 /* { dg-final { scan-rtl-dump-times "Stack clash probe loop" 2 "pro_and_epilogue" } } */
51 /* { dg-final { scan-rtl-dump-times "Stack clash residual allocation in prologue" 4 "pro_and_epilogue" } } */
52 /* { dg-final { scan-rtl-dump-times "Stack clash not noreturn" 4 "pro_and_epilogue" } } */
54 /* { dg-final { scan-rtl-dump-times "Stack clash no frame pointer needed" 4 "pro_and_epilogue" { target { ! frame_pointer_for_non_leaf } } } } */
55 /* { dg-final { scan-rtl-dump-times "Stack clash no frame pointer needed" 2 "pro_and_epilogue" { target { frame_pointer_for_non_leaf } } } } */
56 /* { dg-final { scan-rtl-dump-times "Stack clash frame pointer needed" 2 "pro_and_epilogue" { target { frame_pointer_for_non_leaf } } } } */