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