1 /* This test needs to use setrlimit to set the stack size, so it can
3 /* { dg-do run { target *-*-linux* *-*-gnu* *-*-solaris* *-*-darwin* } } */
4 /* { dg-require-effective-target split_stack } */
5 /* { dg-options "-fsplit-stack" } */
9 #include <sys/resource.h>
11 /* Use a noinline function to ensure that the buffer is not removed
13 static void use_buffer (char *buf
) __attribute__ ((noinline
));
15 use_buffer (char *buf
)
20 /* Each recursive call uses 10,000 bytes. We call it 1000 times,
21 using a total of 10,000,000 bytes. If -fsplit-stack is not
22 working, that will overflow our stack limit. */
41 /* We set a stack limit because we are usually invoked via make, and
42 make sets the stack limit to be as large as possible. */
43 r
.rlim_cur
= 8192 * 1024;
44 r
.rlim_max
= 8192 * 1024;
45 if (setrlimit (RLIMIT_STACK
, &r
) != 0)