]>
Commit | Line | Data |
---|---|---|
ee8f136a IE |
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 first; | |
13 | int a[10]; | |
14 | int b; | |
15 | } S; | |
16 | ||
17 | struct S1 { | |
18 | int a; | |
19 | struct S b[10]; | |
20 | int c; | |
21 | } S1; | |
22 | ||
23 | struct S2 { | |
24 | int x; | |
25 | struct S1 a[10]; | |
26 | struct S1 b; | |
27 | } S2; | |
28 | ||
29 | int foo (int *p, int i) | |
30 | { | |
31 | int res = p[i]; | |
32 | printf ("%d\n", res); | |
33 | return res; | |
34 | } | |
35 | ||
36 | struct S2 s1; | |
37 | struct S2 *s2 = &s1; | |
38 | ||
39 | int mpx_test (int argc, const char **argv) | |
40 | { | |
41 | foo (&(s2->a[argc].b[5].a[0]), 10); | |
42 | ||
43 | return 0; | |
44 | } |