aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2013-12-02 16:08:47 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2013-12-02 16:08:47 +0000
commit76004bbc2d0f71138336842eb9d98f75e18b6df0 (patch)
tree03b3f3d65b7e8858075e5237b064d8e7af2943f5 /gcc
parent100f09a564fb1abe4c8d4712048c473c1fbaf248 (diff)
downloadgcc-76004bbc2d0f71138336842eb9d98f75e18b6df0.zip
gcc-76004bbc2d0f71138336842eb9d98f75e18b6df0.tar.gz
gcc-76004bbc2d0f71138336842eb9d98f75e18b6df0.tar.bz2
vla-1.c: Split the tests into individual functions.
2013-12-02 Marek Polacek <polacek@redhat.com> testsuite/ * c-c++-common/ubsan/vla-1.c: Split the tests into individual functions. From-SVN: r205590
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/vla-1.c97
2 files changed, 89 insertions, 13 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 59c0b5b..9c7be13 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-02 Marek Polacek <polacek@redhat.com>
+
+ * c-c++-common/ubsan/vla-1.c: Split the tests into individual
+ functions.
+
2013-12-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/59139
diff --git a/gcc/testsuite/c-c++-common/ubsan/vla-1.c b/gcc/testsuite/c-c++-common/ubsan/vla-1.c
index 3e47bd3..ca538ed 100644
--- a/gcc/testsuite/c-c++-common/ubsan/vla-1.c
+++ b/gcc/testsuite/c-c++-common/ubsan/vla-1.c
@@ -1,33 +1,104 @@
/* { dg-do run } */
/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */
-static int
+typedef long int V;
+int x = -1;
+double di = -3.2;
+V v = -6;
+
+static int __attribute__ ((noinline, noclone))
bar (void)
{
- return -42;
+ return -4;
}
-typedef long int V;
-int
-main (void)
+static void __attribute__ ((noinline, noclone))
+fn1 (void)
{
- int x = -1;
- double di = -3.2;
- V v = -666;
-
int a[x];
- int aa[x][x];
- int aaa[x][x][x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn2 (void)
+{
+ int a[x][x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn3 (void)
+{
+ int a[x][x][x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn4 (void)
+{
int b[x - 4];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn5 (void)
+{
int c[(int) di];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn6 (void)
+{
int d[1 + x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn7 (void)
+{
int e[1 ? x : -1];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn8 (void)
+{
int f[++x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn9 (void)
+{
int g[(signed char) --x];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn10 (void)
+{
int h[(++x, --x, x)];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn11 (void)
+{
int i[v];
+}
+
+static void __attribute__ ((noinline, noclone))
+fn12 (void)
+{
int j[bar ()];
+}
+int
+main (void)
+{
+ fn1 ();
+ fn2 ();
+ fn3 ();
+ fn4 ();
+ fn5 ();
+ fn6 ();
+ fn7 ();
+ fn8 ();
+ fn9 ();
+ fn10 ();
+ fn11 ();
+ fn12 ();
return 0;
}
@@ -44,5 +115,5 @@ main (void)
/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value 0(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -666(\n|\r\n|\r)" } */
-/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -42(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -6(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -4(\n|\r\n|\r)" } */