Tighten condition in vect/pr85586.c (PR 85654)
[official-gcc.git] / gcc / testsuite / gcc.dg / pr85388-2.c
blob075ab9ed56343bb369f95d3a11635940953b799e
1 /* { dg-do run { target { i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } } } */
2 /* { dg-require-effective-target cet } */
3 /* { dg-require-effective-target split_stack } */
4 /* { dg-require-effective-target pthread_h } */
5 /* { dg-options "-pthread -fsplit-stack -fcf-protection" } */
7 #include <stdlib.h>
8 #include <pthread.h>
10 /* Use a noinline function to ensure that the buffer is not removed
11 from the stack. */
12 static void use_buffer (char *buf) __attribute__ ((noinline));
13 static void
14 use_buffer (char *buf)
16 buf[0] = '\0';
19 /* Each recursive call uses 10,000 bytes. We call it 1000 times,
20 using a total of 10,000,000 bytes. If -fsplit-stack is not
21 working, that will overflow our stack limit. */
23 static void
24 down (int i)
26 char buf[10000];
28 if (i > 0)
30 use_buffer (buf);
31 down (i - 1);
35 static void *
36 thread_routine (void *arg __attribute__ ((unused)))
38 down (1000);
39 return NULL;
42 int
43 main (void)
45 int i;
46 pthread_t tid;
47 void *dummy;
49 i = pthread_create (&tid, NULL, thread_routine, NULL);
50 if (i != 0)
51 abort ();
52 i = pthread_join (tid, &dummy);
53 if (i != 0)
54 abort ();
55 return 0;