]>
Commit | Line | Data |
---|---|---|
ee8f136a IE |
1 | /* { dg-do run } */ |
2 | /* { dg-options "-fcheck-pointer-bounds -mmpx" } */ | |
3 | ||
4 | ||
5 | #include "mpx-check.h" | |
6 | ||
7 | struct s1 | |
8 | { | |
9 | union { | |
10 | int i1; | |
11 | int i3; | |
12 | } v; | |
13 | int i2; | |
14 | union { | |
15 | int *p; | |
16 | int p2; | |
17 | } u; | |
18 | } s1; | |
19 | ||
20 | int rd (struct s1 s) | |
21 | { | |
22 | int res = s.u.p[s.v.i1 + s.i2]; | |
23 | printf ("%d\n", res); | |
24 | return res; | |
25 | } | |
26 | ||
27 | int buf[100]; | |
28 | int buf1[10]; | |
29 | ||
30 | int mpx_test (int argc, const char **argv) | |
31 | { | |
32 | struct s1 s; | |
33 | s.u.p = buf; | |
34 | s.v.i1 = 50; | |
35 | s.i2 = -50; | |
36 | ||
37 | rd (s); | |
38 | ||
39 | s.v.i1 = 50; | |
40 | s.i2 = 49; | |
41 | ||
42 | rd (s); | |
43 | ||
44 | return 0; | |
45 | } |