1 /* { dg-do run } */
2 /* { dg-options "-O2 -fstack-clash-protection -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 /* For further testing, this can be run under valgrind where it's crashed
6 on aarch64 and ppc64le with -fstack-check=specific. */
7
8
9 __attribute__((noinline, noclone)) void
10 foo (char *p)
11 {
12 asm volatile ("" : : "r" (p) : "memory");
13 }
14
15 __attribute__((noinline, noclone)) void
16 bar (void)
17 {
18 char buf[131072];
19 foo (buf);
20 }
21
22 __attribute__((noinline, noclone)) void
23 baz (void)
24 {
25 char buf[12000];
26 foo (buf);
27 }
28
29 int
30 main ()
31 {
32 bar ();
33 baz ();
34 return 0;
35 }
36