diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/mpx/malloc-1-ubv.c')
-rw-r--r-- | gcc/testsuite/gcc.target/i386/mpx/malloc-1-ubv.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/mpx/malloc-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/malloc-1-ubv.c new file mode 100644 index 00000000000..6f48ec26923 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/malloc-1-ubv.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-shouldfail "bounds violation" } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + + +#define SHOULDFAIL + +#include "mpx-check.h" + +int rd (int *p, int i) +{ + int res = p[i]; + printf ("%d\n", res); + return res; +} + +int mpx_test (int argc, const char **argv) +{ + int *buf = (int *)malloc (100 * sizeof(int)); + + rd (buf, 100); + + free (buf); + + return 0; +} |