[NDS32] Add intrinsic functions for TLB operation and data prefech.
[official-gcc.git] / gcc / testsuite / gcc.dg / split-2.c
blob208169aa09501a6269bd49523827f6e549ab3de5
1 /* { dg-do run } */
2 /* { dg-require-effective-target split_stack } */
3 /* { dg-require-effective-target pthread_h } */
4 /* { dg-options "-pthread -fsplit-stack" } */
6 #include <stdlib.h>
7 #include <pthread.h>
9 /* Use a noinline function to ensure that the buffer is not removed
10 from the stack. */
11 static void use_buffer (char *buf) __attribute__ ((noinline));
12 static void
13 use_buffer (char *buf)
15 buf[0] = '\0';
18 /* Each recursive call uses 10,000 bytes. We call it 1000 times,
19 using a total of 10,000,000 bytes. If -fsplit-stack is not
20 working, that will overflow our stack limit. */
22 static void
23 down (int i)
25 char buf[10000];
27 if (i > 0)
29 use_buffer (buf);
30 down (i - 1);
34 static void *
35 thread_routine (void *arg __attribute__ ((unused)))
37 down (1000);
38 return NULL;
41 int
42 main (void)
44 int i;
45 pthread_t tid;
46 void *dummy;
48 i = pthread_create (&tid, NULL, thread_routine, NULL);
49 if (i != 0)
50 abort ();
51 i = pthread_join (tid, &dummy);
52 if (i != 0)
53 abort ();
54 return 0;