1 /* { dg-do run } */
2 /* { dg-options "-fcheck-pointer-bounds -mmpx" } */
3 
4 /* { dg-additional-options "-lpthread" } */
5 
6 
7 #include "mpx-check.h"
8 #include "pthread.h"
9 
10 __thread int prebuf[100];
11 __thread int buf[100];
12 __thread int postbuf[100];
13 
rd(int * p,int i)14 int rd (int *p, int i)
15 {
16   int res = p[i];
17   printf("%d\n", res);
18   return res;
19 }
20 
thred_func(void * ptr)21 void *thred_func (void *ptr)
22 {
23   rd (buf, 0);
24   rd (buf, 99);
25 }
26 
mpx_test(int argc,const char ** argv)27 int mpx_test (int argc, const char **argv)
28 {
29   pthread_t thread;
30   pthread_create (&thread, NULL, thred_func, 0);
31   pthread_join (thread, NULL);
32   return 0;
33 }
34