aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C26
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-12.c26
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-13.c18
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/pr64277.c23
4 files changed, 93 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C b/gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C
new file mode 100644
index 000000000..f2e5f2f59
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// { dg-options "-O3 -Warray-bounds" }
+
+struct type {
+ bool a, b;
+ bool get_b() { return b; }
+};
+
+type stuff[9u];
+
+void bar();
+
+void foo()
+{
+ for(unsigned i = 0u; i < 9u; i++)
+ {
+ if(!stuff[i].a)
+ continue;
+
+ bar();
+
+ for(unsigned j = i + 1u; j < 9u; j++)
+ if(stuff[j].a && stuff[j].get_b()) // { dg-bogus "above array bounds" }
+ return;
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-12.c b/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-12.c
new file mode 100644
index 000000000..ef26c6596
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-12.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -Warray-bounds" } */
+/* { dg-additional-options "-mssse3" { target x86_64-*-* i?86-*-* } } */
+
+void foo(short a[], short m)
+{
+ int i, j;
+ int f1[10];
+ short nc;
+
+ nc = m + 1;
+ if (nc > 3)
+ {
+ for (i = 0; i <= nc; i++)
+ {
+ f1[i] = f1[i] + 1;
+ }
+ }
+
+ for (i = 0, j = m; i < nc; i++, j--)
+ {
+ a[i] = f1[i]; /* { dg-bogus "above array bounds" } */
+ a[j] = i;
+ }
+ return;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-13.c b/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-13.c
new file mode 100644
index 000000000..7b40a8388
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-13.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -Warray-bounds" } */
+
+extern char *bar[17];
+
+int foo(int argc, char **argv)
+{
+ int i;
+ int n = 0;
+
+ for (i = 0; i < argc; i++)
+ n++;
+
+ for (i = 0; i < argc; i++)
+ argv[i] = bar[i + n]; /* { dg-bogus "above array bounds" } */
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr64277.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr64277.c
new file mode 100644
index 000000000..c6ef33119
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr64277.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/64277 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -Wall -Werror -fdump-tree-cunroll-details" } */
+/* { dg-final { scan-tree-dump "loop with 5 iterations completely unrolled" "cunroll" } } */
+/* { dg-final { scan-tree-dump "loop with 6 iterations completely unrolled" "cunroll" } } */
+/* { dg-final { cleanup-tree-dump "cunroll" } } */
+
+int f1[10];
+void test1 (short a[], short m, unsigned short l)
+{
+ int i = l;
+ for (i = i + 5; i < m; i++)
+ f1[i] = a[i]++;
+}
+
+void test2 (short a[], short m, short l)
+{
+ int i;
+ if (m > 5)
+ m = 5;
+ for (i = m; i > l; i--)
+ f1[i] = a[i]++;
+}