aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr35356-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr53265.c156
-rw-r--r--gcc/testsuite/gcc.dg/pr56355-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr49518.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr56661.c46
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr56689.c46
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cunroll-10.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr55579.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vector-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp47.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-3.c68
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-3a.c3
15 files changed, 344 insertions, 20 deletions
diff --git a/gcc/testsuite/gcc.dg/graphite/id-6.c b/gcc/testsuite/gcc.dg/graphite/id-6.c
index c3aab432a59..dd6fecda3bd 100644
--- a/gcc/testsuite/gcc.dg/graphite/id-6.c
+++ b/gcc/testsuite/gcc.dg/graphite/id-6.c
@@ -2,7 +2,7 @@
void foo (int);
int test ()
{
- int a[N];
+ int a[N + 8];
unsigned i;
for (i = 0; i < N; i++)
diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-2.c b/gcc/testsuite/gcc.dg/graphite/pr35356-2.c
index 66cfdea5aef..b406d1096ba 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr35356-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr35356-2.c
@@ -39,6 +39,6 @@ foo (int bar, int n, int k)
*/
-/* { dg-final { scan-tree-dump-times "MIN_EXPR" 4 "graphite" } } */
-/* { dg-final { scan-tree-dump-times "MAX_EXPR" 4 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "MIN_EXPR\[^\\n\\r]*;" 4 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR\[^\\n\\r]*;" 4 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-3.c b/gcc/testsuite/gcc.dg/graphite/scop-3.c
index e20bfdcb34b..18917c0edcc 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-3.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-3.c
@@ -1,7 +1,7 @@
int toto()
{
int i, j, k;
- int a[100][100];
+ int a[100][200];
int b[100];
for (i = 1; i < 100; i++)
diff --git a/gcc/testsuite/gcc.dg/pr53265.c b/gcc/testsuite/gcc.dg/pr53265.c
new file mode 100644
index 00000000000..c60a736a927
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr53265.c
@@ -0,0 +1,156 @@
+/* PR tree-optimization/53265 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall" } */
+
+void bar (void *);
+int baz (int);
+
+void
+fn1 (void)
+{
+ unsigned int a[128];
+ int i;
+
+ for (i = 0; i < 128; ++i) /* { dg-message "note: containing loop" } */
+ a[i] = i * 0x02000001; /* { dg-warning "invokes undefined behavior" } */
+ bar (a);
+}
+
+void
+fn2 (void)
+{
+ unsigned long long a[128];
+ int i;
+
+ for (i = 0; i < 128; i++) /* { dg-message "note: containing loop" } */
+ a[i] = (i + 1LL) * 0x0123456789ABCDEFLL; /* { dg-warning "invokes undefined behavior" } */
+ bar (a);
+}
+
+void
+fn3 (void)
+{
+ unsigned char a[16], b[16], c[16];
+ int i;
+
+ bar (b);
+ for (i = 0; i < (int) (sizeof (a) / sizeof (a[0])); i++) /* { dg-message "note: containing loop" } */
+ {
+ c[i + 8] = b[i]; /* { dg-warning "invokes undefined behavior" } */
+ a[i + 8] = b[i + 8];
+ }
+ bar (a);
+ bar (c);
+}
+
+void
+fn4 (void)
+{
+ unsigned int *a[32], *o, i;
+
+ bar (a);
+ for (i = 0; i <= sizeof (a) / sizeof (a[0]); i++) /* { dg-message "note: containing loop" "" { xfail *-*-* } } */
+ {
+ o = a[i]; /* { dg-warning "invokes undefined behavior" "" { xfail *-*-* } } */
+ bar (o);
+ }
+}
+
+void
+fn5 (void)
+{
+ unsigned short a[23940];
+ unsigned int b[1140];
+ int j;
+
+ bar (b);
+ for (j = 0; j < 1140; j++) /* { dg-message "note: containing loop" } */
+ a[23940 + j - 950] = b[j]; /* { dg-warning "invokes undefined behavior" } */
+ bar (a);
+}
+
+void
+fn6 (void)
+{
+ double a[4][3], b[12];
+ int i;
+ bar (b);
+ for (i = 0; i < 12; i++) /* { dg-message "note: containing loop" } */
+ a[0][i] = b[i] / 10000.0; /* { dg-warning "invokes undefined behavior" } */
+ bar (a);
+}
+
+void
+fn7 (void)
+{
+ int a[16], b, c;
+ bar (a);
+ for (b = a[c = 0]; c < 16; b = a[++c]) /* { dg-warning "invokes undefined behavior" "" { xfail *-*-* } } */
+ baz (b);
+}
+
+/* { dg-message "note: containing loop" "" { xfail *-*-* } 88 } */
+
+const void *va, *vb, *vc, *vd, *ve;
+const void *vf[4];
+void
+fn8 (void)
+{
+ unsigned long i;
+ vf[0] = va; vf[1] = vb; vf[2] = vc; vf[3] = vd;
+ for (i = 0; i < (sizeof (vf) / sizeof (vf[0])); i++)
+ if (!vf[i])
+ vf[i] = ve;
+}
+
+int wa, wb[53][5], wc[53][5];
+
+void
+fn9 (void)
+{
+ int i, j, k;
+ for (i = 0; i < 53; i++)
+ for (j = 16 / (((wa & 1) != 0) ? 8 : 4); j > 0; j--)
+ {
+ int d = 1;
+ if (wb[i][j] == 0 || wc[i][1] != 0)
+ continue;
+ for (k = 0; k < j; k++)
+ if (wc[i + k][1])
+ {
+ d = 0;
+ break;
+ }
+ if (!d)
+ continue;
+ wc[i][j] = baz (0);
+ }
+}
+
+int xa[18];
+
+void
+fn10 (void)
+{
+ int i;
+ for (i = 16; i < 32; i++) /* { dg-message "note: containing loop" } */
+ xa[i] = 26; /* { dg-warning "invokes undefined behavior" } */
+}
+
+__attribute__((noinline)) static void
+fn11 (int x)
+{
+ int i = 1;
+ if (x > 1)
+ do
+ baz (i);
+ while (++i != x); /* { dg-bogus "invokes undefined behavior" } */
+}
+
+void
+fn12 (void)
+{
+ fn11 (1);
+ fn11 (1);
+ fn11 (1);
+}
diff --git a/gcc/testsuite/gcc.dg/pr56355-1.c b/gcc/testsuite/gcc.dg/pr56355-1.c
new file mode 100644
index 00000000000..08b9c2e7109
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr56355-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wstrict-overflow=4" } */
+
+int
+f (int i)
+{
+ return __builtin_abs (i * i); /* { dg-warning "assuming signed overflow" } */
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr49518.c b/gcc/testsuite/gcc.dg/torture/pr49518.c
index 84a10fbbeeb..55761fd6108 100644
--- a/gcc/testsuite/gcc.dg/torture/pr49518.c
+++ b/gcc/testsuite/gcc.dg/torture/pr49518.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-options "-Wno-aggressive-loop-optimizations" } */
int a, b;
struct S { unsigned int s, t, u; } c, d = { 0, 1, 0 };
diff --git a/gcc/testsuite/gcc.dg/torture/pr56661.c b/gcc/testsuite/gcc.dg/torture/pr56661.c
new file mode 100644
index 00000000000..6fdaedb3176
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr56661.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+
+__attribute__((noinline, noclone)) void
+bar (int *b)
+{
+ b[0] = b[1] = b[2] = 1;
+}
+
+__attribute__((noinline, noclone)) int
+baz (int x)
+{
+ if (x != 1)
+ __builtin_abort ();
+}
+
+void
+foo (int x)
+{
+ if (x == 0)
+ {
+ int *b = __builtin_malloc (3 * sizeof (int));
+ while (b[0])
+ ;
+ }
+ else if (x == 1)
+ {
+ int i, j;
+ int *b = __builtin_malloc (3 * sizeof (int));
+ for (i = 0; i < 2; i++)
+ {
+ bar (b);
+ for (j = 0; j < 3; ++j)
+ baz (b[j]);
+ baz (b[0]);
+ }
+ }
+}
+
+int
+main ()
+{
+ int x = 1;
+ asm volatile ("" : "+r" (x));
+ foo (x);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr56689.c b/gcc/testsuite/gcc.dg/torture/pr56689.c
new file mode 100644
index 00000000000..719f528c2c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr56689.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+
+extern int baz ();
+extern void bar (void);
+extern void noret (void) __attribute__ ((__noreturn__));
+
+void
+fix_register (const char *name, int fixed, int call_used, int nregs)
+{
+ int i;
+ int reg;
+
+ if ((reg = baz ()) >= 0)
+ {
+ for (i = reg; i < nregs; i++)
+ {
+ if ((i == 15 || i == 11) && (fixed == 0 || call_used == 0))
+ {
+ switch (fixed)
+ {
+ case 0:
+ switch (call_used)
+ {
+ case 1:
+ bar ();
+ break;
+ default:
+ (noret ());
+ }
+ case 1:
+ switch (call_used)
+ {
+ case 1:
+ break;
+ case 0:
+ default:
+ (noret ());
+ }
+ break;
+ default:
+ (noret ());
+ }
+ }
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-10.c b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-10.c
index 7893565918a..f2cd904efc6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/cunroll-10.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cunroll-10.c
@@ -2,10 +2,11 @@
/* { dg-options "-O3 -Warray-bounds -fdump-tree-cunroll-details" } */
int a[3];
int b[4];
-main()
+int
+foo (int n)
{
int i;
- for (i=0;i<4;i++)
+ for (i=0;i<n;i++)
if (b[i]==2)
a[i]++;
}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr55579.c b/gcc/testsuite/gcc.dg/tree-ssa/pr55579.c
index 741bd41551d..16807cf66c6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr55579.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr55579.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -g -fdump-tree-esra" } */
+/* { dg-options "-O2 -g -fdump-tree-esra -fvar-tracking-assignments" } */
struct S { int a; char b; char c; short d; };
@@ -11,5 +11,5 @@ foo (int x)
return x;
}
-/* { dg-final { scan-tree-dump "Created a debug-only replacement for s" "esra" {xfail { hppa*-*-hpux* && { ! lp64 } } } } } */
+/* { dg-final { scan-tree-dump "Created a debug-only replacement for s" "esra" } } */
/* { dg-final { cleanup-tree-dump "esra" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vector-4.c b/gcc/testsuite/gcc.dg/tree-ssa/vector-4.c
index c2a39ca6751..10aebc47b45 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vector-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vector-4.c
@@ -9,6 +9,7 @@ v4si vs (v4si a, v4si b)
}
/* The compound literal should be placed directly in the vec_perm. */
+/* Test is xfailed on 32-bit hppa*-*-* because target-callee-copies. */
/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR <a, b, { 0, 4, 1, 5 }>;" 1 "gimple" { xfail { hppa*-*-* && { ! lp64 } } } } } */
/* { dg-final { cleanup-tree-dump "gimple" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c
index bf4f0f39e1e..d8c5841eb58 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c
@@ -4,7 +4,7 @@
jumps when evaluating an && condition. VRP is not able to optimize
this. */
/* { dg-do compile { target { ! "mips*-*-* s390*-*-* avr-*-* mn10300-*-*" } } } */
-/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dom1 -fdump-tree-dom2" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dom1 -fdump-tree-vrp2" } */
/* { dg-additional-options "-march=i586" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
/* Skip on ARM Cortex-M0, where LOGICAL_OP_NON_SHORT_CIRCUIT is set to false,
leading to two conditional jumps when evaluating an && condition. VRP is
@@ -40,15 +40,14 @@ int f(int x)
0 or 1. */
/* { dg-final { scan-tree-dump-times "\[xy\]\[^ \]* !=" 0 "vrp1" } } */
-/* This one needs more copy propagation that only happens in dom1. */
-/* { dg-final { scan-tree-dump-times "x\[^ \]* & y" 1 "dom1" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times "x\[^ \]* & y" 1 "dom2" } } */
-/* { dg-final { scan-tree-dump-times "x\[^ \]* & y" 1 "vrp1" { xfail *-*-* } } } */
-
-/* These two are fully simplified by VRP. */
+/* These two are fully simplified by VRP1. */
/* { dg-final { scan-tree-dump-times "x\[^ \]* \[|\] y" 1 "vrp1" } } */
/* { dg-final { scan-tree-dump-times "x\[^ \]* \\^ 1" 1 "vrp1" } } */
+/* VRP2 gets rid of the remaining & 1 operations, x and y are always
+ either 0 or 1. */
+/* { dg-final { scan-tree-dump-times " & 1;" 0 "vrp2" } } */
+
/* { dg-final { cleanup-tree-dump "vrp1" } } */
/* { dg-final { cleanup-tree-dump "dom1" } } */
-/* { dg-final { cleanup-tree-dump "dom2" } } */
+/* { dg-final { cleanup-tree-dump "vrp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-3.c b/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-3.c
new file mode 100644
index 00000000000..5878d418f50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-3.c
@@ -0,0 +1,68 @@
+#include <stdlib.h>
+#include <math.h>
+
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+
+typedef struct {
+ int initialHeight, initialWidth;
+ int rotatedHeight, rotatedWidth;
+ int autoCropHeight, autoCropWidth;
+} ufraw_data;
+
+void __attribute__((noinline,noclone))
+ufraw_test(ufraw_data *uf)
+{
+ int iWidth = uf->initialWidth;
+ int iHeight = uf->initialHeight;
+ double aspectRatio = ((double)iWidth) / iHeight;
+ double midX = iWidth / 2.0 - 0.5;
+ double midY = iHeight / 2.0 - 0.5;
+ double maxX = 0, maxY = 0;
+ double minX = 999999, minY = 999999;
+ double lastX = 0, lastY = 0, area = 0;
+ double scale;
+ int i;
+ for (i = 0; i < iWidth + iHeight - 1; i++)
+ {
+ int x, y;
+ if (i < iWidth) { // Trace the left border of the image
+ x = i;
+ y = 0;
+ } else { // Trace the bottom border of the image
+ x = iWidth - 1;
+ y = i - iWidth + 1;
+ }
+ double srcX = x - midX;
+ double srcY = y - midY;
+ // A digital planimeter:
+ area += srcY * lastX - srcX * lastY;
+ lastX = srcX;
+ lastY = srcY;
+ maxX = MAX(maxX, fabs(srcX));
+ maxY = MAX(maxY, fabs(srcY));
+ if (fabs(srcX / srcY) > aspectRatio)
+ minX = MIN(minX, fabs(srcX));
+ else
+ minY = MIN(minY, fabs(srcY));
+ }
+ scale = sqrt((iWidth - 1) * (iHeight - 1) / area);
+ uf->rotatedWidth = MIN(ceil(2 * maxX + 1.0) * scale, 2 * iWidth);
+ uf->rotatedHeight = MIN(ceil(2 * maxY + 1.0) * scale, 2 * iHeight);
+ uf->autoCropWidth = MIN(floor(2 * minX) * scale, 2 * iWidth);
+ uf->autoCropHeight = MIN(floor(2 * minY) * scale, 2 * iHeight);
+ if (uf->autoCropWidth != 3)
+ abort ();
+}
+
+int main()
+{
+ ufraw_data uf_data;
+ ufraw_data *uf = &uf_data;
+ uf->initialWidth = 4;
+ uf->initialHeight = 5;
+ ufraw_test(uf);
+ return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "slp" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c
index c6486db691b..ecb2d9076d2 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c
@@ -49,6 +49,5 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail vect_no_align } } } */
-/* { dg-final { scan-tree-dump-times "step doesn't divide the vector-size" 2 "vect" { target { ! vect_multiple_sizes } } } } */
-/* { dg-final { scan-tree-dump-times "step doesn't divide the vector-size" 3 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump-times "step doesn't divide the vector-size" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
index 3d6e1076e79..d0b4f80745f 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
@@ -49,6 +49,5 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail vect_no_align } } } */
-/* { dg-final { scan-tree-dump-times "step doesn't divide the vector-size" 2 "vect" { target { ! vect_multiple_sizes } } } } */
-/* { dg-final { scan-tree-dump-times "step doesn't divide the vector-size" 3 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump-times "step doesn't divide the vector-size" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */