1 /* { dg-do run } */
2 /* { dg-shouldfail "bounds violation" } */
3 /* { dg-options "-fcheck-pointer-bounds -mmpx" } */
4 
5 
6 #define SHOULDFAIL
7 
8 #include "mpx-check.h"
9 
10 int buf[100];
11 int *p;
12 
mpx_test(int argc,const char ** argv)13 int mpx_test (int argc, const char **argv)
14 {
15   int *p1 = __bnd_set_ptr_bounds (buf + 10, sizeof (int) * 10);
16   p = buf;
17   __bnd_store_ptr_bounds ((void **)&p, p1 - 10);
18   p[9] = argc;
19   return 0;
20 }
21