summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target
diff options
context:
space:
mode:
authorienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-10 09:48:51 +0000
committerienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-10 09:48:51 +0000
commit3e0baf2a6a86aa44369df1984563905dcb776b37 (patch)
tree1f913dee19299f6e2dca2bcdbb70403cbe412720 /gcc/testsuite/gcc.target
parent4cefd7f71b5c9666489ba23e5cf3615b24891fba (diff)
downloadgcc-3e0baf2a6a86aa44369df1984563905dcb776b37.tar.gz
* lib/mpx-dg.exp (mpx_link_flags): Set path to wrappers library.
* gcc.target/i386/mpx/calloc-1-lbv.c: New. * gcc.target/i386/mpx/calloc-1-ubv.c: New. * gcc.target/i386/mpx/calloc-1-nov.c: New. * gcc.target/i386/mpx/malloc-1-lbv.c: New. * gcc.target/i386/mpx/malloc-1-nov.c: New. * gcc.target/i386/mpx/malloc-1-ubv.c: New. * gcc.target/i386/mpx/realloc-1-lbv.c: New. * gcc.target/i386/mpx/realloc-1-nov.c: New. * gcc.target/i386/mpx/realloc-1-ubv.c: New. * gcc.target/i386/mpx/realloc-2-lbv.c: New. * gcc.target/i386/mpx/realloc-2-nov.c: New. * gcc.target/i386/mpx/realloc-2-ubv.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221315 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target')
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/calloc-1-lbv.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/calloc-1-nov.c24
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/calloc-1-ubv.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/malloc-1-lbv.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/malloc-1-nov.c24
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/malloc-1-ubv.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/realloc-1-lbv.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/realloc-1-nov.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/realloc-1-ubv.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/realloc-2-lbv.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/realloc-2-nov.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/realloc-2-ubv.c27
12 files changed, 310 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/mpx/calloc-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/calloc-1-lbv.c
new file mode 100644
index 00000000000..0ba5d73229d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/calloc-1-lbv.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 *)calloc (100, sizeof(int));
+
+ rd (buf, -1);
+
+ free (buf);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/calloc-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/calloc-1-nov.c
new file mode 100644
index 00000000000..cb755e57391
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/calloc-1-nov.c
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx" } */
+
+
+#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 *)calloc (100, sizeof(int));
+
+ rd (buf, 0);
+ rd (buf, 99);
+
+ free (buf);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/calloc-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/calloc-1-ubv.c
new file mode 100644
index 00000000000..a932a8c7b47
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/calloc-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 *)calloc (100, sizeof(int));
+
+ rd (buf, 100);
+
+ free (buf);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/malloc-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/malloc-1-lbv.c
new file mode 100644
index 00000000000..aa2aed983cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/malloc-1-lbv.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, -1);
+
+ free (buf);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/malloc-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/malloc-1-nov.c
new file mode 100644
index 00000000000..56f26e964d8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/malloc-1-nov.c
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx" } */
+
+
+#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, 0);
+ rd (buf, 99);
+
+ free (buf);
+
+ return 0;
+}
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;
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/realloc-1-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/realloc-1-lbv.c
new file mode 100644
index 00000000000..961196f71c0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/realloc-1-lbv.c
@@ -0,0 +1,27 @@
+/* { 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));
+ buf = (int *)realloc (buf, 200 * sizeof(int));
+
+ rd (buf, -1);
+
+ free (buf);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/realloc-1-nov.c b/gcc/testsuite/gcc.target/i386/mpx/realloc-1-nov.c
new file mode 100644
index 00000000000..f4b3dd86081
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/realloc-1-nov.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx" } */
+
+
+#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));
+ buf = (int *)realloc (buf, 200 * sizeof(int));
+
+ rd (buf, 0);
+ rd (buf, 199);
+
+ free (buf);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/realloc-1-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/realloc-1-ubv.c
new file mode 100644
index 00000000000..8a14baa7a94
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/realloc-1-ubv.c
@@ -0,0 +1,27 @@
+/* { 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));
+ buf = (int *)realloc (buf, 200 * sizeof(int));
+
+ rd (buf, 200);
+
+ free (buf);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/realloc-2-lbv.c b/gcc/testsuite/gcc.target/i386/mpx/realloc-2-lbv.c
new file mode 100644
index 00000000000..919f62a490e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/realloc-2-lbv.c
@@ -0,0 +1,27 @@
+/* { 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));
+ buf = (int *)realloc (buf, 10 * sizeof(int));
+
+ rd (buf, -1);
+
+ free (buf);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/realloc-2-nov.c b/gcc/testsuite/gcc.target/i386/mpx/realloc-2-nov.c
new file mode 100644
index 00000000000..569cd241cc9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/realloc-2-nov.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx" } */
+
+
+#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));
+ buf = (int *)realloc (buf, 10 * sizeof(int));
+
+ rd (buf, 0);
+ rd (buf, 9);
+
+ free (buf);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/realloc-2-ubv.c b/gcc/testsuite/gcc.target/i386/mpx/realloc-2-ubv.c
new file mode 100644
index 00000000000..36eb90c1abf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/realloc-2-ubv.c
@@ -0,0 +1,27 @@
+/* { 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));
+ buf = (int *)realloc (buf, 10 * sizeof(int));
+
+ rd (buf, 10);
+
+ free (buf);
+
+ return 0;
+}