]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/i386/mpx/struct-arg-2-lbv.c
d796ced340dae83928d6abd649437a4abedafe39
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / i386 / mpx / struct-arg-2-lbv.c
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 struct s1
11 {
12 int i1;
13 int i2;
14 int *p;
15 } s1;
16
17 int rd (struct s1 s)
18 {
19 int res = s.p[s.i1 + s.i2];
20 printf ("%d\n", res);
21 return res;
22 }
23
24 int buf[100];
25
26 int mpx_test (int argc, const char **argv)
27 {
28 struct s1 s;
29 s.p = buf;
30 s.i1 = 50;
31 s.i2 = -51;
32
33 rd (s);
34
35 return 0;
36 }