1 /* { dg-do run } */
2 /* { dg-shouldfail "bounds violation" } */
3 /* { dg-options "-fcheck-pointer-bounds -mmpx" } */
4 
5 /* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */
6 
7 #define SHOULDFAIL
8 
9 #include "mpx-check.h"
10 
11 struct S {
12   int arr[100];
13 } S;
14 
15 struct S sa[10];
16 
rd(int * p,int i)17 int rd (int *p, int i)
18 {
19   int res = p[i];
20   printf ("%d\n", res);
21   return res;
22 }
23 
mpx_test(int argc,const char ** argv)24 int mpx_test (int argc, const char **argv)
25 {
26   rd (&sa[argc].arr[0], 100);
27 
28   return 0;
29 }
30