blob: d2792e1bba4d8d6905c99964feb84d9f46749c60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/* { dg-do run } */
/* { dg-shouldfail "bounds violation" } */
/* { dg-options "-fcheck-pointer-bounds -mmpx" } */
/* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */
#define SHOULDFAIL
#include "mpx-check.h"
struct S {
int a[10];
int b;
} S;
struct S1 {
int a;
struct S b[10];
int c;
} S1;
struct S2 {
int x;
struct S1 a[10];
struct S1 b;
} S2;
int foo (int *p, int i)
{
int res = p[i];
printf ("%d\n", res);
return res;
}
struct S2 s1;
struct S2 *s2 = &s1;
int mpx_test (int argc, const char **argv)
{
foo (&(s1.a[argc].b[10].a[0]), 9);
return 0;
}
|