aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-11-10 07:26:18 -0800
committerIan Lance Taylor <iant@golang.org>2020-11-10 07:26:18 -0800
commit8d703821c69062c0cd255787d793e44f1a95d463 (patch)
tree6b1df9cdc36cc47b6164db69a14bc86a63dc77c6 /gcc/testsuite/gcc.dg
parent9cd320ea6572c577cdf17ce1f9ea5230b166af6d (diff)
parentcf392dbdf17e38026f8e3c0e9af7f5b87f63be56 (diff)
downloadgcc-8d703821c69062c0cd255787d793e44f1a95d463.zip
gcc-8d703821c69062c0cd255787d793e44f1a95d463.tar.gz
gcc-8d703821c69062c0cd255787d793e44f1a95d463.tar.bz2
Merge from trunk revision cf392dbdf17e38026f8e3c0e9af7f5b87f63be56.
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/20031223-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-12.c2
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-13.c2
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-3.c4
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-6.c1
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-68.c118
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-70.c18
-rw-r--r--gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-9.c3
-rw-r--r--gcc/testsuite/gcc.dg/Wnonnull-5.c53
-rw-r--r--gcc/testsuite/gcc.dg/Wrestrict-22.c9
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-44.s271
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-56.c163
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-57.c91
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-larger-than-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-8.c86
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/callbacks-1.c25
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/callbacks-2.c22
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/callbacks-3.c19
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-21.c8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/malloc-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97514.c18
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97568.c29
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97608.c17
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97668.c27
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/setjmp-pr93378.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/test-setjmp.h15
-rw-r--r--gcc/testsuite/gcc.dg/asan/pr80166.c1
-rw-r--r--gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-6.c1
-rw-r--r--gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-7.c1
-rw-r--r--gcc/testsuite/gcc.dg/atomic/stdatomic-op-5.c1
-rw-r--r--gcc/testsuite/gcc.dg/attr-alloc_size-11.c4
-rw-r--r--gcc/testsuite/gcc.dg/c11-bool-1.c50
-rw-r--r--gcc/testsuite/gcc.dg/c11-labels-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/c11-labels-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/c11-labels-3.c15
-rw-r--r--gcc/testsuite/gcc.dg/c11-parm-omit-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/c11-parm-omit-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/c11-parm-omit-3.c5
-rw-r--r--gcc/testsuite/gcc.dg/c11-parm-omit-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-deprecated-4.c12
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-fallthrough-4.c7
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c12
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-nodiscard-1.c62
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c42
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-nodiscard-3.c11
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-nodiscard-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-syntax-3.c7
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-syntax-5.c5
-rw-r--r--gcc/testsuite/gcc.dg/c2x-bool-1.c50
-rw-r--r--gcc/testsuite/gcc.dg/c2x-labels-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/c2x-labels-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/c2x-labels-3.c38
-rw-r--r--gcc/testsuite/gcc.dg/c2x-parm-omit-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/c2x-parm-omit-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/c2x-parm-omit-3.c23
-rw-r--r--gcc/testsuite/gcc.dg/c2x-parm-omit-4.c5
-rw-r--r--gcc/testsuite/gcc.dg/c99-bool-4.c46
-rw-r--r--gcc/testsuite/gcc.dg/cpp/endif.c14
-rw-r--r--gcc/testsuite/gcc.dg/cpp/endif.h1
-rw-r--r--gcc/testsuite/gcc.dg/darwin-minversion-link.c5
-rw-r--r--gcc/testsuite/gcc.dg/decl-9.c3
-rw-r--r--gcc/testsuite/gcc.dg/dfp/builtin-snan-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/dfp/builtin-snan-2.c44
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pr97439.c27
-rw-r--r--gcc/testsuite/gcc.dg/gomp/barrier-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/declare-simd-5.c3
-rw-r--r--gcc/testsuite/gcc.dg/gomp/declare-variant-2.c3
-rw-r--r--gcc/testsuite/gcc.dg/guality/guality.exp2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inlinehint-5.c36
-rw-r--r--gcc/testsuite/gcc.dg/ipa/modref-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/ipa/modref-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/label-compound-stmt-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/lto/modref-2_0.c27
-rw-r--r--gcc/testsuite/gcc.dg/no-strict-overflow-4.c5
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/pr79758.c2
-rw-r--r--gcc/testsuite/gcc.dg/parse-decl-after-label.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr36093.c31
-rw-r--r--gcc/testsuite/gcc.dg/pr43783.c25
-rw-r--r--gcc/testsuite/gcc.dg/pr66552.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr68671.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr91441.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr96260.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr96307.c25
-rw-r--r--gcc/testsuite/gcc.dg/pr97360-2.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr97378.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr97381.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr97396.c23
-rw-r--r--gcc/testsuite/gcc.dg/pr97462.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr97463.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr97467.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr97488.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr97501.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr97502.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr97505.c23
-rw-r--r--gcc/testsuite/gcc.dg/pr97515.c25
-rw-r--r--gcc/testsuite/gcc.dg/pr97520.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr97539.c17
-rw-r--r--gcc/testsuite/gcc.dg/pr97555.c22
-rw-r--r--gcc/testsuite/gcc.dg/pr97567-2.c24
-rw-r--r--gcc/testsuite/gcc.dg/pr97567.c34
-rw-r--r--gcc/testsuite/gcc.dg/pr97596.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr97721.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr97725.c28
-rw-r--r--gcc/testsuite/gcc.dg/pr97737.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr97741.c17
-rw-r--r--gcc/testsuite/gcc.dg/pragma-diag-6.c9
-rw-r--r--gcc/testsuite/gcc.dg/self-right-shift.c12
-rw-r--r--gcc/testsuite/gcc.dg/sin_cos.c41
-rw-r--r--gcc/testsuite/gcc.dg/sms-12.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/pr97461.c64
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-4.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr71077.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr84512.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr96789.c58
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr97456.c40
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr97503.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-7.c54
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/switch-4.c25
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-41.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-52.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-53.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-54.c23
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-55.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-56.c17
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-57.c38
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-58.c24
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-59.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-60.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-61.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-62.c21
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-63.c21
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-64.c11
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-65.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-66.c32
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-67.c16
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-68.c22
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-69.c45
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c27
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97496.c14
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97615.c23
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97626.c34
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97633.c27
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97650.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97706.c61
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97709.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97732.c11
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97746.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97428.c44
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97457.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97558-2.c54
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97558.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97678.c29
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97753.c10
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97760.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97769.c32
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-11b.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-49.c38
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-perm-6.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/tree-vect.h2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-103.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-91.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-complex-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-slp-1.c31
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-slp-2.c51
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-slp-3.c62
178 files changed, 3380 insertions, 378 deletions
diff --git a/gcc/testsuite/gcc.dg/20031223-1.c b/gcc/testsuite/gcc.dg/20031223-1.c
index 68aa74f..c529739 100644
--- a/gcc/testsuite/gcc.dg/20031223-1.c
+++ b/gcc/testsuite/gcc.dg/20031223-1.c
@@ -3,11 +3,10 @@
because GCC was trying to expand the trees to rtl. */
/* { dg-do compile } */
-/* { dg-options "" } */
+/* { dg-options "-std=c17 -pedantic-errors" } */
void f ()
{
l: int; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" "not stmt" } */
- /* { dg-warning "useless type name in empty declaration" "type name" { target *-*-* } .-1 } */
- /* { dg-error "label at end of compound statement" "label" { target *-*-* } .-2 } */
+ /* { dg-error "useless type name in empty declaration" "type name" { target *-*-* } .-1 } */
}
diff --git a/gcc/testsuite/gcc.dg/Walloca-1.c b/gcc/testsuite/gcc.dg/Walloca-1.c
index 85e9160..37ee191 100644
--- a/gcc/testsuite/gcc.dg/Walloca-1.c
+++ b/gcc/testsuite/gcc.dg/Walloca-1.c
@@ -24,8 +24,7 @@ void foo1 (size_t len, size_t len2, size_t len3)
char *s = alloca (123);
useit (s); // OK, constant argument to alloca
- s = alloca (num); // { dg-warning "large due to conversion" "" { target lp64 } }
- // { dg-warning "unbounded use of 'alloca'" "" { target { ! lp64 } } .-1 }
+ s = alloca (num); // { dg-warning "\(may be too large|unbounded use\)" }
useit (s);
s = alloca (30000); /* { dg-warning "is too large" } */
diff --git a/gcc/testsuite/gcc.dg/Walloca-12.c b/gcc/testsuite/gcc.dg/Walloca-12.c
index 059c5f3..d2d9413 100644
--- a/gcc/testsuite/gcc.dg/Walloca-12.c
+++ b/gcc/testsuite/gcc.dg/Walloca-12.c
@@ -8,5 +8,5 @@ void g (unsigned int n)
{
if (n == 7)
n = 11;
- f (__builtin_alloca (n)); /* { dg-warning "unbounded use of 'alloca'" } */
+ f (__builtin_alloca (n)); /* { dg-warning "may be too large" } */
}
diff --git a/gcc/testsuite/gcc.dg/Walloca-13.c b/gcc/testsuite/gcc.dg/Walloca-13.c
index 12e9f6c..99d6206 100644
--- a/gcc/testsuite/gcc.dg/Walloca-13.c
+++ b/gcc/testsuite/gcc.dg/Walloca-13.c
@@ -8,5 +8,5 @@ void g (int *p, int *q)
{
__SIZE_TYPE__ n = (__SIZE_TYPE__)(p - q);
if (n < 100)
- f (__builtin_alloca (n)); // { dg-bogus "may be too large due to conversion" "" { xfail { *-*-* } } }
+ f (__builtin_alloca (n)); // { dg-bogus "may be too large" "" { xfail { *-*-* } } }
}
diff --git a/gcc/testsuite/gcc.dg/Walloca-2.c b/gcc/testsuite/gcc.dg/Walloca-2.c
index 766ff8d..1cf9165 100644
--- a/gcc/testsuite/gcc.dg/Walloca-2.c
+++ b/gcc/testsuite/gcc.dg/Walloca-2.c
@@ -24,7 +24,7 @@ g2 (int n)
{
void *p;
if (n < 2000)
- p = __builtin_alloca (n); // { dg-warning "large due to conversion" }
+ p = __builtin_alloca (n); // { dg-warning "may be too large" }
else
p = __builtin_malloc (n);
f (p);
@@ -36,9 +36,7 @@ g3 (int n)
void *p;
if (n > 0 && n < 3000)
{
- p = __builtin_alloca (n); // { dg-warning "'alloca' may be too large" "" { target lp64} }
- // { dg-message "note:.*argument may be as large as 2999" "note" { target lp64 } .-1 }
- // { dg-warning "unbounded use of 'alloca'" "" { target { ! lp64 } } .-2 }
+ p = __builtin_alloca (n); // { dg-warning "may be too large" }
}
else
p = __builtin_malloc (n);
diff --git a/gcc/testsuite/gcc.dg/Walloca-3.c b/gcc/testsuite/gcc.dg/Walloca-3.c
index f5840673..b8000ff 100644
--- a/gcc/testsuite/gcc.dg/Walloca-3.c
+++ b/gcc/testsuite/gcc.dg/Walloca-3.c
@@ -13,7 +13,7 @@ g1 (__SIZE_TYPE__ n)
{
void *p;
if (n < LIMIT)
- p = __builtin_alloca (n); // { dg-warning "'alloca' bound is unknown" }
+ p = __builtin_alloca (n); // { dg-warning "may be too large" }
else
p = __builtin_malloc (n);
f (p);
@@ -27,7 +27,7 @@ g2 (unsigned short n)
{
void *p;
if (n < SHORT_LIMIT)
- p = __builtin_alloca (n); // { dg-warning "'alloca' bound is unknown" }
+ p = __builtin_alloca (n); // { dg-warning "may be too large" }
else
p = __builtin_malloc (n);
f (p);
diff --git a/gcc/testsuite/gcc.dg/Walloca-6.c b/gcc/testsuite/gcc.dg/Walloca-6.c
index 16b5d6f..ebe08ae 100644
--- a/gcc/testsuite/gcc.dg/Walloca-6.c
+++ b/gcc/testsuite/gcc.dg/Walloca-6.c
@@ -1,7 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target alloca } */
/* { dg-options "-Walloca-larger-than=256 -O2" } */
-/* { dg-xfail-if "Currently broken but Andrew's work should fix this" { *-*-* } } */
void f (void*);
void g (__SIZE_TYPE__ n)
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-68.c b/gcc/testsuite/gcc.dg/Warray-bounds-68.c
new file mode 100644
index 0000000..d661669
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-68.c
@@ -0,0 +1,118 @@
+/* PR middle-end/97391 - bogus -Warray-bounds accessing a multidimensional
+ array parameter
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+
+void nowarn_access_loop_idx (char a[3][5])
+{
+ for (int i = 0; i < 3; i++)
+ for (int j = 0; j < 5; j++)
+ a[i][j] = 0;
+}
+
+void warn_access_loop_idx (char a[3][5])
+{
+ for (int i = 0; i < 3; i++)
+ for (int j = 0; j < 5; j++)
+ a[j][i] = 0; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+
+void nowarn_access_cst_idx (int a[5][7][9])
+{
+ a[0][0][0] = __LINE__;
+ a[0][0][8] = __LINE__;
+
+ a[0][6][0] = __LINE__;
+ a[0][6][8] = __LINE__;
+
+ a[4][0][0] = __LINE__;
+ a[4][0][8] = __LINE__;
+ a[4][6][8] = __LINE__;
+}
+
+
+void test_ptr_access_cst_idx (int a[5][7][9])
+{
+ int *p = &a[0][0][0];
+
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+
+ /* The following access should trigger a warning but it's represented
+ the same as the valid access in
+ p = a[0][1][0];
+ p[1] = __LINE__;
+ both as
+ MEM[(int *)a_1(D) + 36B] = __LINE__; */
+
+ p[9] = __LINE__; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ p[315] = __LINE__;
+ // { dg-warning "subscript 315 is outside array bounds of 'int\\\[5]\\\[7]\\\[9]'" "pr97425" { xfail *-*-* } .-1 }
+ // { dg-warning "subscript 315 is outside array bounds " "" { target *-*-* } .-2 }
+
+ p = &a[0][6][0];
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+
+ p = &a[4][6][0];
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+}
+
+
+void warn_access_cst_idx (int a[5][7][9])
+{
+ a[0][0][9] = __LINE__; // { dg-warning "subscript 9 is above array bounds of 'int\\\[9]'" }
+ a[0][7][0] = __LINE__; // { dg-warning "subscript 7 is above array bounds of 'int\\\[7]\\\[9]'" }
+ a[5][0][0] = __LINE__;
+ // { dg-warning "subscript 5 is outside array bounds of 'int\\\[5]\\\[7]\\\[9]'" "pr97425" { xfail *-*-* } .-1 }
+ // { dg-warning "subscript \\d+ is outside array bounds" "" { target *-*-* } .-2 }
+}
+
+
+void test_ptrarray_access_cst_idx (int (*pa)[5][7][9])
+{
+ (*pa)[0][0][0] = __LINE__;
+ (*pa)[0][0][8] = __LINE__;
+ (*pa)[0][0][9] = __LINE__; // { dg-warning "subscript 9 is above array bounds of 'int\\\[9]'" }
+
+ (*pa)[0][6][0] = __LINE__;
+ (*pa)[0][7][0] = __LINE__; // { dg-warning "subscript 7 is above array bounds of 'int\\\[7]\\\[9]'" }
+ (*pa)[0][8][0] = __LINE__; // { dg-warning "subscript 8 is above array bounds of 'int\\\[7]\\\[9]'" }
+
+ (*pa)[4][6][8] = __LINE__;
+ (*pa)[5][0][0] = __LINE__; // { dg-warning "subscript 5 is above array bounds of 'int\\\[5]\\\[7]\\\[9]'" }
+}
+
+
+void test_ptr_ptrarray_access_cst_idx (int (*pa)[5][7][9])
+{
+ int *p = &(*pa)[0][0][0];
+
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+
+ /* The following access should trigger a warning but it's represented
+ the same as the valid access in
+ p = a[0][1][0];
+ p[1] = __LINE__;
+ both as
+ MEM[(int *)a_1(D) + 36B] = __LINE__; */
+
+ p[9] = __LINE__; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ p[315] = __LINE__; // { dg-warning "\\\[-Warray-bounds" "pr97429" { xfail *-*-* } }
+
+ p = &(*pa)[0][6][0];
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+
+ p = &(*pa)[4][6][0];
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+}
+
+
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-70.c b/gcc/testsuite/gcc.dg/Warray-bounds-70.c
new file mode 100644
index 0000000..087e255
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-70.c
@@ -0,0 +1,18 @@
+/* PR middle-end/97556 - ICE on excessively large index into a multidimensional
+ array
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+#define SIZE_MAX __SIZE_MAX__
+
+typedef __SIZE_TYPE__ size_t;
+
+char a[1][3];
+
+void f (int c)
+{
+ size_t i = c ? SIZE_MAX / 2 : SIZE_MAX;
+ a[i][0] = 0; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+// { dg-prune-output "\\\[-Wstringop-overflow=" }
diff --git a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-9.c b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-9.c
index 56a827a..82db8fe 100644
--- a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-9.c
+++ b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-9.c
@@ -12,4 +12,5 @@ void a (void)
}
/* The invalid scanf call may also trigger:
- { dg-prune-output "accessing 4 bytes in a region of size 1" } */
+ { dg-prune-output "accessing 4 bytes in a region of size 1" }
+ { dg-prune-output "accessing 2 bytes in a region of size 1" } */
diff --git a/gcc/testsuite/gcc.dg/Wnonnull-5.c b/gcc/testsuite/gcc.dg/Wnonnull-5.c
new file mode 100644
index 0000000..ef6ed54
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wnonnull-5.c
@@ -0,0 +1,53 @@
+/* PR middle-end/97552 - missing waning passing null to a VLA argument
+ declared [static]
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+#define A(...) __attribute__ ((__VA_ARGS__))
+
+void fptr_array (int(*)[0]);
+
+void fstatic_array (int[static 0]);
+void A (nonnull) fnonnull_static_array (int [static 0]);
+
+void fvla (int n, int [n]);
+void A (nonnull) fnonnull_vla (int n, int [n]);
+
+void fstatic_vla (int n, int [static n]);
+void A (nonnull) fnonnull_static_vla (int n, int [static n]);
+
+
+void test_null (void)
+{
+ fptr_array (0);
+ fptr_array (&(int[0]){ });
+
+ fstatic_array (0); // { dg-warning "\\\[-Wnonnull" }
+ fnonnull_static_array (0); // { dg-warning "\\\[-Wnonnull" }
+
+ fvla (0, 0);
+ fnonnull_vla (0, 0); // { dg-warning "\\\[-Wnonnull" }
+
+ fstatic_vla (0, 0); // { dg-warning "\\\[-Wnonnull" }
+ fnonnull_static_vla (0, 0); // { dg-warning "\\\[-Wnonnull" }
+}
+
+
+#pragma GCC optimize ("1")
+
+void test_null_optimized (void)
+{
+ int (*pa)[0] = 0;
+ fptr_array (pa);
+
+ int *p = 0;
+
+ fstatic_array (p); // { dg-warning "\\\[-Wnonnull" }
+ fnonnull_static_array (p); // { dg-warning "\\\[-Wnonnull" }
+
+ fvla (0, p);
+ fnonnull_vla (0, p); // { dg-warning "\\\[-Wnonnull" }
+
+ fstatic_vla (0, p); // { dg-warning "\\\[-Wnonnull" }
+ fnonnull_static_vla (0, p); // { dg-warning "\\\[-Wnonnull" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wrestrict-22.c b/gcc/testsuite/gcc.dg/Wrestrict-22.c
new file mode 100644
index 0000000..46f507b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wrestrict-22.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wrestrict" } */
+
+void test_memcpy_warn (char *d, unsigned n)
+{
+ for (unsigned i = n; i < 30; ++i)
+ if (i > 10)
+ __builtin_memcpy (d, d + 2, i); /* { dg-warning "overlaps" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-44.s b/gcc/testsuite/gcc.dg/Wstringop-overflow-44.s
deleted file mode 100644
index 0fc73a9..0000000
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-44.s
+++ /dev/null
@@ -1,271 +0,0 @@
- .file "Wstringop-overflow-44.c"
- .text
- .p2align 4
- .globl f0
- .type f0, @function
-f0:
-.LFB0:
- .cfi_startproc
- ret
- .cfi_endproc
-.LFE0:
- .size f0, .-f0
- .p2align 4
- .globl f1
- .type f1, @function
-f1:
-.LFB1:
- .cfi_startproc
- ret
- .cfi_endproc
-.LFE1:
- .size f1, .-f1
- .p2align 4
- .globl f2
- .type f2, @function
-f2:
-.LFB2:
- .cfi_startproc
- movl n(%rip), %eax
- testl %eax, %eax
- jle .L12
-.L4:
- ret
- .p2align 4,,10
- .p2align 3
-.L12:
- movslq %eax, %rdx
- movq d(%rip), %rcx
- testq %rdx, %rdx
- je .L4
- xorl %eax, %eax
-.L6:
- movb $0, (%rcx,%rax)
- addq $1, %rax
- cmpq %rdx, %rax
- jb .L6
- ret
- .cfi_endproc
-.LFE2:
- .size f2, .-f2
- .p2align 4
- .globl f3
- .type f3, @function
-f3:
-.LFB3:
- .cfi_startproc
- movslq n(%rip), %rdx
- testl %edx, %edx
- jle .L15
- ret
- .p2align 4,,10
- .p2align 3
-.L15:
- movq %rdi, %rsi
- movq d(%rip), %rdi
- jmp strncpy
- .cfi_endproc
-.LFE3:
- .size f3, .-f3
- .p2align 4
- .globl f4
- .type f4, @function
-f4:
-.LFB4:
- .cfi_startproc
- movl n(%rip), %eax
- testl %eax, %eax
- jle .L18
- ret
- .p2align 4,,10
- .p2align 3
-.L18:
- movq d(%rip), %rax
- movq %rdi, %rsi
- movb $0, (%rax)
- movslq n(%rip), %rdx
- movq d(%rip), %rdi
- jmp strncat
- .cfi_endproc
-.LFE4:
- .size f4, .-f4
- .p2align 4
- .globl g0
- .type g0, @function
-g0:
-.LFB5:
- .cfi_startproc
- movl n(%rip), %eax
- testl %eax, %eax
- jle .L25
- ret
- .p2align 4,,10
- .p2align 3
-.L25:
- subq $24, %rsp
- .cfi_def_cfa_offset 32
- leaq 15(%rsp), %rdi
- call sink
- addq $24, %rsp
- .cfi_def_cfa_offset 8
- ret
- .cfi_endproc
-.LFE5:
- .size g0, .-g0
- .p2align 4
- .globl g1
- .type g1, @function
-g1:
-.LFB6:
- .cfi_startproc
- movl n(%rip), %eax
- testl %eax, %eax
- jle .L32
- ret
- .p2align 4,,10
- .p2align 3
-.L32:
- subq $24, %rsp
- .cfi_def_cfa_offset 32
- leaq 15(%rsp), %rdi
- call sink
- addq $24, %rsp
- .cfi_def_cfa_offset 8
- ret
- .cfi_endproc
-.LFE6:
- .size g1, .-g1
- .p2align 4
- .globl g2
- .type g2, @function
-g2:
-.LFB7:
- .cfi_startproc
- movl n(%rip), %eax
- testl %eax, %eax
- jle .L45
- ret
- .p2align 4,,10
- .p2align 3
-.L45:
- movslq %eax, %rdx
- subq $24, %rsp
- .cfi_def_cfa_offset 32
- testq %rdx, %rdx
- je .L36
- xorl %eax, %eax
-.L35:
- movb $0, 15(%rsp,%rax)
- addq $1, %rax
- cmpq %rdx, %rax
- jb .L35
-.L36:
- leaq 15(%rsp), %rdi
- call sink
- addq $24, %rsp
- .cfi_def_cfa_offset 8
- ret
- .cfi_endproc
-.LFE7:
- .size g2, .-g2
- .p2align 4
- .globl g3
- .type g3, @function
-g3:
-.LFB8:
- .cfi_startproc
- movslq n(%rip), %rdx
- testl %edx, %edx
- jle .L52
- ret
- .p2align 4,,10
- .p2align 3
-.L52:
- subq $24, %rsp
- .cfi_def_cfa_offset 32
- movq %rdi, %rsi
- leaq 15(%rsp), %rdi
- call strncpy
- leaq 15(%rsp), %rdi
- call sink
- addq $24, %rsp
- .cfi_def_cfa_offset 8
- ret
- .cfi_endproc
-.LFE8:
- .size g3, .-g3
- .p2align 4
- .globl g4
- .type g4, @function
-g4:
-.LFB9:
- .cfi_startproc
- movslq n(%rip), %rdx
- testl %edx, %edx
- jle .L59
- ret
- .p2align 4,,10
- .p2align 3
-.L59:
- subq $24, %rsp
- .cfi_def_cfa_offset 32
- movq %rdi, %rsi
- leaq 15(%rsp), %rdi
- movb $0, 15(%rsp)
- call strncat
- leaq 15(%rsp), %rdi
- call sink
- addq $24, %rsp
- .cfi_def_cfa_offset 8
- ret
- .cfi_endproc
-.LFE9:
- .size g4, .-g4
- .p2align 4
- .globl h0
- .type h0, @function
-h0:
-.LFB10:
- .cfi_startproc
- movl n(%rip), %eax
- testl %eax, %eax
- jle .L66
- ret
- .p2align 4,,10
- .p2align 3
-.L66:
- subq $8, %rsp
- .cfi_def_cfa_offset 16
- movl $1, %edi
- call malloc
- movq %rax, d(%rip)
- addq $8, %rsp
- .cfi_def_cfa_offset 8
- ret
- .cfi_endproc
-.LFE10:
- .size h0, .-h0
- .p2align 4
- .globl h1
- .type h1, @function
-h1:
-.LFB16:
- .cfi_startproc
- movl n(%rip), %eax
- testl %eax, %eax
- jle .L73
- ret
- .p2align 4,,10
- .p2align 3
-.L73:
- subq $8, %rsp
- .cfi_def_cfa_offset 16
- movl $1, %edi
- call malloc
- movq %rax, d(%rip)
- addq $8, %rsp
- .cfi_def_cfa_offset 8
- ret
- .cfi_endproc
-.LFE16:
- .size h1, .-h1
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-56.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-56.c
new file mode 100644
index 0000000..b3e598c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-56.c
@@ -0,0 +1,163 @@
+/* PR middle-end/92942 - missing -Wstringop-overflow for allocations with
+ a negative lower bound size
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+#define SIZE_MAX __SIZE_MAX__
+#define UINT8_MAX __UINT8_MAX__
+#define UINT16_MAX __UINT16_MAX__
+
+typedef __SIZE_TYPE__ size_t;
+typedef __UINT8_TYPE__ uint8_t;
+typedef __UINT16_TYPE__ uint16_t;
+
+void* usr_alloc1 (size_t) __attribute__ ((alloc_size (1)));
+void* usr_alloc2 (size_t, size_t) __attribute__ ((alloc_size (1, 2)));
+
+void* malloc (size_t);
+void* memcpy (void*, const void*, size_t);
+void* memset (void*, int, size_t);
+char* strcpy (char*, const char*);
+
+void sink (void*);
+
+void malloc_uint_range_strcpy (unsigned n)
+{
+ void *p = malloc (5 < n ? 5 : n);
+
+ strcpy (p, "01234"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ strcpy (p, "0123");
+ sink (p);
+}
+
+void malloc_uint16_anti_range_memset (uint16_t n)
+{
+ if (5 <= n && n <= 9) return;
+ void *p = malloc (n);
+
+ if (UINT16_MAX < SIZE_MAX)
+ {
+ size_t sz = (uint16_t)-1 + (size_t)1;
+ memset (p, 0, sz); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+ }
+
+ memset (p, 0, 1);
+ sink (p);
+ memset (p, 0, 5);
+ sink (p);
+ memset (p, 0, 6);
+ sink (p);
+ memset (p, 0, UINT16_MAX - 1);
+ sink (p);
+ memset (p, 0, UINT16_MAX);
+ sink (p);
+}
+
+void malloc_int_strcpy (int n)
+{
+ void *p = malloc (7 < n ? 7 : n);
+
+ strcpy (p, "0123456"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ strcpy (p, "012345");
+ sink (p);
+}
+
+void vla_int_strcpy (int n)
+{
+ char a[9 < n ? 9 : n];
+
+ strcpy (a, "012345678"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (a);
+
+ strcpy (a, "01234567");
+ sink (a);
+}
+
+void usr_alloc1_int_strcpy (int n)
+{
+ void *p = usr_alloc1 (7 < n ? 7 : n);
+
+ strcpy (p, "0123456"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ strcpy (p, "012345");
+ sink (p);
+}
+
+void usr_alloc2_cst_ir_strcpy (int n)
+{
+ void *p = usr_alloc2 (1, 5 < n ? 5 : n);
+
+ strcpy (p, "01234"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ strcpy (p, "0123");
+ sink (p);
+}
+
+void usr_alloc2_ir_ir_strcpy (int m, int n)
+{
+ void *p = usr_alloc2 (3 < n ? 3 : n, 5 < n ? 5 : n);
+
+ strcpy (p, "0123456789abcde"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ strcpy (p, "0123456789abcd");
+ sink (p);
+}
+
+void usr_alloc2_uint8_memset (uint8_t m, uint8_t n)
+{
+ if (3 <= m && m <= 7) return;
+ if (5 <= n && n <= 9) return;
+ void *p = usr_alloc2 (m, n);
+
+ size_t sz = UINT8_MAX * UINT8_MAX + 1;
+ memset (p, 0, sz); // { dg-warning "\\\[-Wstringop-overflow" "" { xfail *-*-* } }
+ // { dg-warning "\\\[-Warray-bounds" "pr?????" { target *-*-* } .-1 }
+ sink (p);
+
+ memset (p, 0, sz - 1);
+ sink (p);
+ memset (p, 0, 64);
+ sink (p);
+ memset (p, 0, 63);
+ sink (p);
+ memset (p, 0, 16);
+ sink (p);
+ memset (p, 0, 15);
+ sink (p);
+ memset (p, 0, 14);
+ sink (p);
+ memset (p, 0, 3);
+ sink (p);
+}
+
+
+
+void malloc_int_memset (int n)
+{
+ void *p = malloc (11 < n ? 11 : n);
+
+ memset (p, 0, 12); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ memset (p, 0, 11);
+ sink (p);
+}
+
+void vla_int_memset (int n)
+{
+ char a[13 < n ? 13 : n];
+
+ memset (a, 0, 14); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (a);
+
+ memset (a, 0, 13);
+ sink (a);
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-57.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-57.c
new file mode 100644
index 0000000..173aa16
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-57.c
@@ -0,0 +1,91 @@
+/* Verify that an anti-range ~[A, B] with small positive A and B
+ is handled correctly and doesn't trigger warnings.
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+typedef __typeof__ (sizeof 0) size_t;
+
+int f (void*, size_t);
+int g (void*);
+
+// Test case distilled from gcc/cp/semantics.c
+
+int omp_reduction_id (int i, int j, const char *mm)
+{
+ const char *p = 0;
+ const char *m = 0;
+
+ switch (i)
+ {
+ case 1:
+ p = "min";
+ break;
+ case 2:
+ p = "max";
+ break;
+ default:
+ break;
+ }
+
+ if (j)
+ m = mm;
+
+ const char prefix[] = "omp declare reduction ";
+ size_t lenp = sizeof (prefix);
+
+ if (__builtin_strncmp (p, prefix, lenp - 1) == 0)
+ lenp = 1;
+
+ size_t len = __builtin_strlen (p);
+ size_t lenm = m ? __builtin_strlen (m) + 1 : 0;
+ char *name = ((char *) __builtin_alloca(lenp + len + lenm));
+
+ if (lenp > 1)
+ __builtin_memcpy (name, prefix, lenp - 1);
+
+ __builtin_memcpy (name + lenp - 1, p, len + 1);
+ if (m)
+ {
+ name[lenp + len - 1] = '~';
+ __builtin_memcpy (name + lenp + len, m, lenm);
+ }
+ return (__builtin_constant_p (name)
+ ? f (name, __builtin_strlen (name)) : g (name));
+}
+
+// Test case derived from gcc/d/dmd/root/filename.c.
+
+const char *ext (const char *str)
+{
+ size_t len = __builtin_strlen(str);
+
+ const char *e = str + len;
+ for (;;)
+ {
+ switch (*e)
+ {
+ case '.': return e + 1;
+ case '/': break;
+ default:
+ if (e == str)
+ break;
+ e--;
+ continue;
+ }
+ return 0;
+ }
+}
+
+const char *removeExt (const char *str)
+{
+ const char *e = ext (str);
+ if (e)
+ {
+ size_t len = (e - str) - 1;
+ char *n = (char *)__builtin_malloc (len + 1);
+ __builtin_memcpy(n, str, len);
+ n[len] = 0;
+ return n;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/Wvla-larger-than-2.c b/gcc/testsuite/gcc.dg/Wvla-larger-than-2.c
index 5c0ba51..a3a0534 100644
--- a/gcc/testsuite/gcc.dg/Wvla-larger-than-2.c
+++ b/gcc/testsuite/gcc.dg/Wvla-larger-than-2.c
@@ -24,7 +24,6 @@ f2 (__SIZE_TYPE__ a)
{
// 11 * 4 bytes = 44: Not OK.
uint32_t x[a]; // { dg-warning "array may be too large" }
- // { dg-message "note:.*argument may be as large as 44" "note" { target *-*-* } .-1 }
f0 (x);
}
}
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-2.c b/gcc/testsuite/gcc.dg/Wvla-parameter-2.c
index ba93241..01728e7 100644
--- a/gcc/testsuite/gcc.dg/Wvla-parameter-2.c
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-2.c
@@ -67,9 +67,9 @@ void a2pampan (int (*(*(*[2])[n1])[n2]));
int f2ia1_1 (int n, int [n][n]); // { sg-message "previously declared as 'int\\\[n]\\\[n]' with bound argument 1" }
int f2ia1_1 (int n, int[static n][n]);
int f2ia1_1 (int n, int a[static n][n]) { return sizeof *a; }
-int f2ia1_1 (int n, int[static n + 1][n]); // { dg-warning "argument 2 of type 'int\\\[n \\\+ 1]\\\[n]' declared with mismatched bound 'n \\\+ 1'" }
+int f2ia1_1 (int n, int[static n + 1][n]); // { dg-warning "argument 2 of type 'int\\\[static *n \\\+ 1]\\\[n]' declared with mismatched bound 'n \\\+ 1'" }
-int f2ias1_1 (int n, int [static n][n]); // { dg-message "previously declared as 'int\\\[n]\\\[n]' with bound argument 1" }
+int f2ias1_1 (int n, int [static n][n]); // { dg-message "previously declared as 'int\\\[static +n]\\\[n]' with bound argument 1" }
int f2ias1_1 (int n, int[n][n]);
int f2ias1_1 (int n, int a[++n][n]) // { dg-warning "argument 2 of type 'int\\\[\\\+\\\+n]\\\[n]' declared with mismatched bound ' ?\\+\\+n'" }
{ return sizeof *a; }
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-8.c b/gcc/testsuite/gcc.dg/Wvla-parameter-8.c
new file mode 100644
index 0000000..69e10f7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-8.c
@@ -0,0 +1,86 @@
+/* PR c/97413 - bogus error on function declaration with many VLA arguments:
+ wrong number of arguments specified for 'access' attribute
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+extern int n;
+
+void f1 (int[n]);
+void f2 (int[n], int[n]);
+void f3 (int[n], int[n], int[n]);
+void f4 (int[n], int[n], int[n], int[n]);
+void f5 (int[n], int[n], int[n], int[n], int[n]);
+void f6 (int[n], int[n], int[n], int[n], int[n], int[n]);
+void f7 (int[n], int[n], int[n], int[n], int[n], int[n], int[n]);
+void f8 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n]);
+void f9 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n],
+ int[n]);
+void f10 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n],
+ int[n], int[n]);
+
+
+void f1 (int[n]);
+void f2 (int[n], int[n]);
+void f3 (int[n], int[n], int[n]);
+void f4 (int[n], int[n], int[n], int[n]);
+void f5 (int[n], int[n], int[n], int[n], int[n]);
+void f6 (int[n], int[n], int[n], int[n], int[n], int[n]);
+void f7 (int[n], int[n], int[n], int[n], int[n], int[n], int[n]);
+void f8 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n]);
+void f9 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n],
+ int[n]);
+void f10 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n],
+ int[n], int[n]);
+
+
+void g (int n)
+{
+ typedef int A[n];
+
+ void g1 (A);
+ void g2 (A, A);
+ void g3 (A, A, A);
+ void g4 (A, A, A, A);
+ void g5 (A, A, A, A, A);
+ void g6 (A, A, A, A, A, A);
+ void g7 (A, A, A, A, A, A, A);
+ void g8 (A, A, A, A, A, A, A, A);
+ void g9 (A, A, A, A, A, A, A, A, A);
+ void g10 (A, A, A, A, A, A, A, A, A, A);
+
+ void g1 (A);
+ void g2 (A, A);
+ void g3 (A, A, A);
+ void g4 (A, A, A, A);
+ void g5 (A, A, A, A, A);
+ void g6 (A, A, A, A, A, A);
+ void g7 (A, A, A, A, A, A, A);
+ void g8 (A, A, A, A, A, A, A, A);
+ void g9 (A, A, A, A, A, A, A, A, A);
+ void g10 (A, A, A, A, A, A, A, A, A, A);
+
+
+ typedef int B[n][n + 1][n + 2][n + 3][n + 4][n + 5][n + 7];
+
+ void h1 (B);
+ void h2 (B, B);
+ void h3 (B, B, B);
+ void h4 (B, B, B, B);
+ void h5 (B, B, B, B, B);
+ void h6 (B, B, B, B, B, B);
+ void h7 (B, B, B, B, B, B, B);
+ void h8 (B, B, B, B, B, B, B, B);
+ void h9 (B, B, B, B, B, B, B, B, B);
+ void h10 (B, B, B, B, B, B, B, B, B, B);
+
+ void h1 (B);
+ void h2 (B, B);
+ void h3 (B, B, B);
+ void h4 (B, B, B, B);
+ void h5 (B, B, B, B, B);
+ void h6 (B, B, B, B, B, B);
+ void h7 (B, B, B, B, B, B, B);
+ void h8 (B, B, B, B, B, B, B, B);
+ void h9 (B, B, B, B, B, B, B, B, B);
+ void h10 (B, B, B, B, B, B, B, B, B, B);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/callbacks-1.c b/gcc/testsuite/gcc.dg/analyzer/callbacks-1.c
new file mode 100644
index 0000000..52c8fde
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/callbacks-1.c
@@ -0,0 +1,25 @@
+/* Reproducer for PR analyzer/97258: we should report the double-free
+ inside a static callback if the callback escapes. */
+
+#include <stdlib.h>
+
+static void callback_1 (void *p)
+{
+ free (p);
+ free (p); /* { dg-warning "double-'free' of 'p'" } */
+}
+
+struct ops {
+ void (*cb) (void *);
+};
+
+static const struct ops ops_1 = {
+ .cb = callback_1
+};
+
+extern void registration (const void *);
+
+void register_1 (void)
+{
+ registration (&ops_1);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/callbacks-2.c b/gcc/testsuite/gcc.dg/analyzer/callbacks-2.c
new file mode 100644
index 0000000..98915ee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/callbacks-2.c
@@ -0,0 +1,22 @@
+/* Reproducer for PR analyzer/97258: we should report the double-free
+ inside a static callback if the callback is accessible via a global
+ initializer. */
+
+#include <stdlib.h>
+
+static void callback_1 (void *p)
+{
+ free (p);
+ free (p); /* { dg-warning "double-'free' of 'p'" } */
+}
+
+struct ops {
+ void (*cb) (void *);
+};
+
+/* Callback struct is not static, and so could be accessed via
+ another TU. */
+
+const struct ops ops_1 = {
+ .cb = callback_1
+};
diff --git a/gcc/testsuite/gcc.dg/analyzer/callbacks-3.c b/gcc/testsuite/gcc.dg/analyzer/callbacks-3.c
new file mode 100644
index 0000000..5f12c2a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/callbacks-3.c
@@ -0,0 +1,19 @@
+#include "analyzer-decls.h"
+
+typedef __SIZE_TYPE__ size_t;
+typedef int (*__compar_fn_t)(const void *, const void *);
+extern void qsort(void *__base, size_t __nmemb, size_t __size,
+ __compar_fn_t __compar)
+ __attribute__((__nonnull__(1, 4)));
+
+static int
+test_1_callback (const void *p1, const void *p2)
+{
+ __analyzer_dump_path (); /* { dg-message "here" } */
+ return 0;
+}
+
+void test_1_caller (int *arr, size_t n)
+{
+ qsort (arr, n, sizeof (int), test_1_callback);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-21.c b/gcc/testsuite/gcc.dg/analyzer/data-model-21.c
new file mode 100644
index 0000000..b952bcb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-21.c
@@ -0,0 +1,8 @@
+extern const char XtStrings[];
+
+void unknown_fn (void *);
+
+void test (void)
+{
+ unknown_fn ((char*)&XtStrings[429]);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
index c3e1330..38ce1a5 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
@@ -509,6 +509,14 @@ void test_42c (void)
free (q - 64); /* this is probably OK. */
} /* { dg-bogus "leak of 'p'" } */
+void *
+test_42d (void)
+{
+ void *p = malloc (1024);
+ void *q = p + 64;
+ return q;
+} /* { dg-bogus "leak of 'p'" } */
+
#if 0
void test_31 (void *p)
{
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr97514.c b/gcc/testsuite/gcc.dg/analyzer/pr97514.c
new file mode 100644
index 0000000..27245f4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr97514.c
@@ -0,0 +1,18 @@
+/* { dg-additional-options "--param analyzer-max-enodes-per-program-point=0 -Wno-analyzer-too-complex" } */
+
+typedef void (*sighandler_t) (int);
+
+void
+signal (int, sighandler_t);
+
+static void
+kw (int signum)
+{
+ (void) signum;
+}
+
+void
+gk (int ot)
+{
+ signal (ot, kw);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr97568.c b/gcc/testsuite/gcc.dg/analyzer/pr97568.c
new file mode 100644
index 0000000..22d574b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr97568.c
@@ -0,0 +1,29 @@
+#include "analyzer-decls.h"
+
+#define NULL ((void *)0)
+
+extern int *const p1;
+
+int *const p2;
+
+int v3;
+extern int *const p3 = &v3; /* { dg-warning "'p3' initialized and declared 'extern'" } */
+
+int v4;
+int *const p4 = &v4;
+
+int main (void)
+{
+ __analyzer_describe (0, p1); /* { dg-message "INIT_VAL\\(p1\\)" } */
+ __analyzer_eval (p1 == NULL); /* { dg-message "UNKNOWN" } */
+
+ __analyzer_eval (p2 == NULL); /* { dg-message "TRUE" } */
+
+ __analyzer_describe (0, p3); /* { dg-message "&v3" } */
+ __analyzer_eval (p3 == NULL); /* { dg-message "FALSE" } */
+
+ __analyzer_describe (0, p4); /* { dg-message "&v4" } */
+ __analyzer_eval (p4 == NULL); /* { dg-message "FALSE" } */
+
+ return p1[0];
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr97608.c b/gcc/testsuite/gcc.dg/analyzer/pr97608.c
new file mode 100644
index 0000000..a2bc130
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr97608.c
@@ -0,0 +1,17 @@
+#include <stdlib.h>
+
+void *f (void)
+{
+ void *p = malloc (8);
+ if (p == NULL)
+ abort ();
+ return (void *) ((char *) p + 0);
+}
+
+void *g (void)
+{
+ void *p = malloc (8);
+ if (p == NULL)
+ abort ();
+ return (void *) ((char *) p + 1);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr97668.c b/gcc/testsuite/gcc.dg/analyzer/pr97668.c
new file mode 100644
index 0000000..6ec8164
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr97668.c
@@ -0,0 +1,27 @@
+/* { dg-additional-options "-O1" } */
+
+void
+wb (_Complex double jh)
+{
+ _Complex double af = 0.0;
+
+ do
+ {
+ af += jh;
+ }
+ while (af != 0.0);
+}
+
+_Complex double
+o6 (void)
+{
+ _Complex double ba = 0.0;
+
+ for (;;)
+ {
+ wb (ba);
+ ba = 1.0;
+ }
+
+ return ba;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/setjmp-pr93378.c b/gcc/testsuite/gcc.dg/analyzer/setjmp-pr93378.c
index 6e2468e..e31e127 100644
--- a/gcc/testsuite/gcc.dg/analyzer/setjmp-pr93378.c
+++ b/gcc/testsuite/gcc.dg/analyzer/setjmp-pr93378.c
@@ -1,7 +1,7 @@
/* { dg-additional-options "-O1 -g" } */
/* { dg-require-effective-target indirect_jumps } */
-#include <setjmp.h>
+#include "test-setjmp.h"
jmp_buf buf;
diff --git a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
index 2bc73e8..d6a9910 100644
--- a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
+++ b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target sigsetjmp } */
-#include <setjmp.h>
+#include "test-setjmp.h"
#include <stddef.h>
#include "analyzer-decls.h"
diff --git a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
index d45804b..f89277e 100644
--- a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
+++ b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target sigsetjmp } */
-#include <setjmp.h>
+#include "test-setjmp.h"
#include <stddef.h>
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h b/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h
index ee0e1ec..db24227 100644
--- a/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h
+++ b/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h
@@ -7,10 +7,19 @@
setjmp is a function on some systems and a macro on others.
This header provides a SETJMP macro in a (fake) system header,
- for consistency of output across such systems. */
-
-#include <setjmp.h>
+ along with precanned decls of setjmp, for consistency of output across
+ different systems. */
#pragma GCC system_header
+struct __jmp_buf_tag {};
+typedef struct __jmp_buf_tag jmp_buf[1];
+typedef struct __jmp_buf_tag sigjmp_buf[1];
+
+extern int setjmp(jmp_buf env);
+extern int sigsetjmp(sigjmp_buf env, int savesigs);
+
+extern void longjmp(jmp_buf env, int val);
+extern void siglongjmp(sigjmp_buf env, int val);
+
#define SETJMP(E) setjmp(E)
diff --git a/gcc/testsuite/gcc.dg/asan/pr80166.c b/gcc/testsuite/gcc.dg/asan/pr80166.c
index 629dd23..5e153b2 100644
--- a/gcc/testsuite/gcc.dg/asan/pr80166.c
+++ b/gcc/testsuite/gcc.dg/asan/pr80166.c
@@ -1,5 +1,6 @@
/* PR sanitizer/80166 */
/* { dg-do run } */
+/* { dg-additional-options "-Wno-stringop-overflow" } */
#include <sys/types.h>
#include <unistd.h>
diff --git a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-6.c b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-6.c
index 2dc91c5..900559b 100644
--- a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-6.c
+++ b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-6.c
@@ -3,6 +3,7 @@
still occurs. */
/* { dg-do run } */
/* { dg-options "-std=c11 -pedantic-errors" } */
+/* { dg-xfail-run-if "PR97444: stack atomics" { nvptx*-*-* } }*/
#define TEST_POINTER_ADD_SUB(TYPE) \
do \
diff --git a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-7.c b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-7.c
index eb7082d..d000083 100644
--- a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-7.c
+++ b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-7.c
@@ -2,6 +2,7 @@
we generate correct code. */
/* { dg-do run } */
/* { dg-options "-std=c11 -pedantic-errors -fdump-tree-original" } */
+/* { dg-xfail-run-if "PR97444: stack atomics" { nvptx*-*-* } }*/
#include <stdatomic.h>
#include <limits.h>
diff --git a/gcc/testsuite/gcc.dg/atomic/stdatomic-op-5.c b/gcc/testsuite/gcc.dg/atomic/stdatomic-op-5.c
index daba8ec..f0e8581 100644
--- a/gcc/testsuite/gcc.dg/atomic/stdatomic-op-5.c
+++ b/gcc/testsuite/gcc.dg/atomic/stdatomic-op-5.c
@@ -2,6 +2,7 @@
we generate correct code. */
/* { dg-do run } */
/* { dg-options "-std=c11 -pedantic-errors -fdump-tree-original" } */
+/* { dg-xfail-run-if "PR97444: stack atomics" { nvptx*-*-* } }*/
#include <stdatomic.h>
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-11.c b/gcc/testsuite/gcc.dg/attr-alloc_size-11.c
index a3d95c4..8332b39 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-11.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-11.c
@@ -47,8 +47,8 @@ typedef __SIZE_TYPE__ size_t;
/* The following tests fail because of missing range information. The xfail
exclusions are PR79356. */
-TEST (signed char, SCHAR_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for signed char" { xfail { ! { aarch64*-*-* arm*-*-* avr-*-* alpha*-*-* ia64-*-* mips*-*-* or1k*-*-* pdp11*-*-* powerpc*-*-* sparc*-*-* s390*-*-* visium-*-* msp430-*-* } } } } */
-TEST (short, SHRT_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for short" { xfail { ! { aarch64*-*-* arm*-*-* alpha*-*-* avr-*-* ia64-*-* mips*-*-* or1k*-*-* pdp11*-*-* powerpc*-*-* sparc*-*-* s390x-*-* visium-*-* msp430-*-* } } } } */
+TEST (signed char, SCHAR_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for signed char" { xfail { ! { aarch64*-*-* arm*-*-* avr-*-* alpha*-*-* ia64-*-* mips*-*-* or1k*-*-* pdp11*-*-* powerpc*-*-* sparc*-*-* s390*-*-* visium-*-* msp430-*-* nvptx*-*-*} } } } */
+TEST (short, SHRT_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for short" { xfail { ! { aarch64*-*-* arm*-*-* alpha*-*-* avr-*-* ia64-*-* mips*-*-* or1k*-*-* pdp11*-*-* powerpc*-*-* sparc*-*-* s390x-*-* visium-*-* msp430-*-* nvptx*-*-* } } } } */
TEST (int, INT_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" } */
TEST (int, -3, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" } */
TEST (int, -2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" } */
diff --git a/gcc/testsuite/gcc.dg/c11-bool-1.c b/gcc/testsuite/gcc.dg/c11-bool-1.c
new file mode 100644
index 0000000..0412624
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-bool-1.c
@@ -0,0 +1,50 @@
+/* Test macro expansions in <stdbool.h> in C11. */
+/* { dg-do run } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+#include <stdbool.h>
+
+#define str(x) xstr(x)
+#define xstr(x) #x
+
+extern void abort (void);
+extern void exit (int);
+extern int strcmp (const char *, const char *);
+
+#if false - 1 >= 0
+#error "false unsigned in #if"
+#endif
+
+#if false != 0
+#error "false not 0 in #if"
+#endif
+
+#if true - 2 >= 0
+#error "true unsigned in #if"
+#endif
+
+#if true != 1
+#error "true not 1 in #if"
+#endif
+
+int
+main (void)
+{
+ if (strcmp (str (bool), "_Bool") != 0)
+ abort ();
+ if (_Generic (true, int : 1) != 1)
+ abort ();
+ if (true != 1)
+ abort ();
+ if (strcmp (str (true), "1") != 0)
+ abort ();
+ if (_Generic (false, int : 1) != 1)
+ abort ();
+ if (false != 0)
+ abort ();
+ if (strcmp (str (false), "0") != 0)
+ abort ();
+ if (strcmp (str (__bool_true_false_are_defined), "1") != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c11-labels-1.c b/gcc/testsuite/gcc.dg/c11-labels-1.c
new file mode 100644
index 0000000..6350403
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-labels-1.c
@@ -0,0 +1,15 @@
+/* Tests for labels before declarations and at ends of compound statements. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11" } */
+
+int f(int x)
+{
+ goto b;
+ a: int i = 2 * x;
+ goto c;
+ b: goto a;
+ { i *= 3; c: }
+ return i;
+ d:
+}
+
diff --git a/gcc/testsuite/gcc.dg/c11-labels-2.c b/gcc/testsuite/gcc.dg/c11-labels-2.c
new file mode 100644
index 0000000..e9b4924
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-labels-2.c
@@ -0,0 +1,15 @@
+/* Tests for labels before declarations and at ends of compound statements. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic" } */
+
+int f(int x)
+{
+ goto b;
+ a: int i = 2 * x; /* { dg-warning "a label can only be part of a statement and a declaration is not a statement" } */
+ goto c;
+ b: goto a;
+ { i *= 3; c: } /* { dg-warning "label at end of compound statement" } */
+ return i;
+ d: /* { dg-warning "label at end of compound statement" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/c11-labels-3.c b/gcc/testsuite/gcc.dg/c11-labels-3.c
new file mode 100644
index 0000000..1e4be63
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-labels-3.c
@@ -0,0 +1,15 @@
+/* Tests for labels before declarations and at ends of compound statements. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+int f(int x)
+{
+ goto b;
+ a: int i = 2 * x; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" } */
+ goto c;
+ b: goto a;
+ { i *= 3; c: } /* { dg-error "label at end of compound statement" } */
+ return i;
+ d: /* { dg-error "label at end of compound statement" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/c11-parm-omit-1.c b/gcc/testsuite/gcc.dg/c11-parm-omit-1.c
new file mode 100644
index 0000000..83d1b50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-parm-omit-1.c
@@ -0,0 +1,5 @@
+/* Test omitted parameter names not in C11: -pedantic-errors. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+void f (int) { } /* { dg-error "omitting parameter names" } */
diff --git a/gcc/testsuite/gcc.dg/c11-parm-omit-2.c b/gcc/testsuite/gcc.dg/c11-parm-omit-2.c
new file mode 100644
index 0000000..2efd450
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-parm-omit-2.c
@@ -0,0 +1,5 @@
+/* Test omitted parameter names not in C11: -pedantic. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic" } */
+
+void f (int) { } /* { dg-warning "omitting parameter names" } */
diff --git a/gcc/testsuite/gcc.dg/c11-parm-omit-3.c b/gcc/testsuite/gcc.dg/c11-parm-omit-3.c
new file mode 100644
index 0000000..5bf27a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-parm-omit-3.c
@@ -0,0 +1,5 @@
+/* Test omitted parameter names not in C11: -pedantic -Wno-c11-c2x-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic -Wno-c11-c2x-compat" } */
+
+void f (int) { }
diff --git a/gcc/testsuite/gcc.dg/c11-parm-omit-4.c b/gcc/testsuite/gcc.dg/c11-parm-omit-4.c
new file mode 100644
index 0000000..ea4cbfa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-parm-omit-4.c
@@ -0,0 +1,6 @@
+/* Test omitted parameter names not in C11: accepted by default in the
+ absence of -pedantic. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11" } */
+
+void f (int) { }
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-deprecated-4.c b/gcc/testsuite/gcc.dg/c2x-attr-deprecated-4.c
index f1848a2..7698434 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-deprecated-4.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-deprecated-4.c
@@ -1,13 +1,11 @@
-/* Test C2x deprecated attribute: duplicates. */
+/* Test C2x deprecated attribute: duplicates (allowed after N2557). */
/* { dg-do compile } */
/* { dg-options "-std=c2x -pedantic-errors" } */
-[[deprecated, __deprecated__]] int a; /* { dg-error "can appear at most once" } */
-[[__deprecated__, deprecated("message")]] int b; /* { dg-error "can appear at most once" } */
-int c [[deprecated("message"), deprecated]]; /* { dg-error "can appear at most once" } */
-[[deprecated, deprecated]]; /* { dg-error "can appear at most once" } */
+[[deprecated, __deprecated__]] int a;
+[[__deprecated__, deprecated("message")]] int b;
+int c [[deprecated("message"), deprecated]];
+[[deprecated, deprecated]];
/* { dg-error "ignored" "ignored" { target *-*-* } .-1 } */
-/* Separate attribute lists in the same attribute specifier sequence,
- with the same attribute in them, are OK. */
[[deprecated]] [[deprecated]] int d [[deprecated]] [[deprecated]];
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-4.c b/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-4.c
index 75aceff..a6cedcd 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-4.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-4.c
@@ -1,4 +1,4 @@
-/* Test C2x fallthrough attribute: duplicates. */
+/* Test C2x fallthrough attribute: duplicates (allowed after N2557). */
/* { dg-do compile } */
/* { dg-options "-std=c2x -pedantic-errors" } */
@@ -9,12 +9,9 @@ f (int a)
{
case 1:
a++;
- [[fallthrough, __fallthrough__]]; /* { dg-error "can appear at most once" } */
+ [[fallthrough, __fallthrough__]]; /* { dg-warning "specified multiple times" } */
case 2:
a++;
- /* Separate attribute lists in the same attribute specifier
- sequence, with the same attribute in them, are OK (but
- receive a warning). */
[[fallthrough]] [[fallthrough]]; /* { dg-warning "specified multiple times" } */
case 3:
a++;
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c b/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c
index 300c0da..6b997aa 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c
@@ -1,13 +1,11 @@
-/* Test C2x maybe_unused attribute: duplicates. */
+/* Test C2x maybe_unused attribute: duplicates (allowed after N2557). */
/* { dg-do compile } */
/* { dg-options "-std=c2x -pedantic-errors" } */
-[[maybe_unused, __maybe_unused__]] int a; /* { dg-error "can appear at most once" } */
-[[__maybe_unused__, maybe_unused]] int b; /* { dg-error "can appear at most once" } */
-int c [[maybe_unused, maybe_unused]]; /* { dg-error "can appear at most once" } */
-[[maybe_unused, maybe_unused]]; /* { dg-error "can appear at most once" } */
+[[maybe_unused, __maybe_unused__]] int a;
+[[__maybe_unused__, maybe_unused]] int b;
+int c [[maybe_unused, maybe_unused]];
+[[maybe_unused, maybe_unused]];
/* { dg-error "ignored" "ignored" { target *-*-* } .-1 } */
-/* Separate attribute lists in the same attribute specifier sequence,
- with the same attribute in them, are OK. */
[[maybe_unused]] [[maybe_unused]] int d [[maybe_unused]] [[maybe_unused]];
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-1.c b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-1.c
new file mode 100644
index 0000000..f4893bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-1.c
@@ -0,0 +1,62 @@
+/* Test C2x deprecated attribute: valid uses. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+[[nodiscard]] int c1 (void); /* { dg-message "declared here" } */
+[[__nodiscard__ ("some reason")]] int c2 (void); /* { dg-message "declared here" } */
+
+struct [[nodiscard ("struct reason")]] s1 { int a; };
+struct [[__nodiscard__]] s2 { long b; };
+struct s1 cs1 (void); /* { dg-message "declared here" } */
+struct s2 cs2 (void); /* { dg-message "declared here" } */
+typedef struct s2 s2t;
+s2t cs3 (void); /* { dg-message "declared here" } */
+
+union [[nodiscard]] u1 { int a; long b; };
+union [[nodiscard ("union reason")]] u2 { short c; float d; };
+union u1 cu1 (void); /* { dg-message "declared here" } */
+union u2 cu2 (void); /* { dg-message "declared here" } */
+
+enum [[nodiscard]] e1 { E1 };
+enum [[nodiscard ("enum reason")]] e2 { E2 };
+enum e1 ce1 (void); /* { dg-message "declared here" } */
+enum e2 ce2 (void); /* { dg-message "declared here" } */
+enum e1 ce1a (void);
+int i;
+
+[[nodiscard]] void v (void); /* { dg-warning "void return type" } */
+
+int ok (void);
+
+void
+f (void)
+{
+ c1 (); /* { dg-warning "ignoring return value" } */
+ c2 (); /* { dg-warning "some reason" } */
+ cs1 (); /* { dg-warning "struct reason" } */
+ cs2 (); /* { dg-warning "ignoring return value of type" } */
+ cs3 (); /* { dg-warning "ignoring return value of type" } */
+ cu1 (); /* { dg-warning "ignoring return value of type" } */
+ cu2 (); /* { dg-warning "union reason" } */
+ ce1 (); /* { dg-warning "ignoring return value of type" } */
+ ce2 (); /* { dg-warning "enum reason" } */
+ ok ();
+ c1 (), ok (); /* { dg-warning "ignoring return value" } */
+ cs1 (), ok (); /* { dg-warning "struct reason" } */
+ ok (), cu1 (); /* { dg-warning "ignoring return value" } */
+ ok (), (ok (), (ok (), ce2 ())); /* { dg-warning "enum reason" } */
+ (ok (), cu1 ()), ok (); /* { dg-warning "ignoring return value" } */
+ v ();
+ (i ? ce1 : ce1a) (); /* { dg-warning "ignoring return value of type" } */
+ (void) c1 ();
+ (void) c2 ();
+ (void) cs1 ();
+ (void) cs2 ();
+ (void) cs3 ();
+ (void) cu1 ();
+ (void) cu2 ();
+ (void) ce1 ();
+ (void) ce2 ();
+ (void) (ok (), cu1 ());
+ (void) (i ? ce1 : ce1a) ();
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c
new file mode 100644
index 0000000..45c4d50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c
@@ -0,0 +1,42 @@
+/* Test C2x nodiscard attribute: invalid contexts. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+/* This attribute is not valid on types other than their definitions,
+ or on declarations other than function declarations, or on
+ statements, or as an attribute-declaration. */
+
+[[nodiscard]]; /* { dg-error "ignored" } */
+
+int [[nodiscard]] var; /* { dg-error "ignored" } */
+
+int [[nodiscard ("reason")]] var2; /* { dg-error "ignored" } */
+
+int array_with_nod_type[2] [[nodiscard]]; /* { dg-error "ignored" } */
+
+void fn_with_nod_type () [[nodiscard]]; /* { dg-error "ignored" } */
+
+int z = sizeof (int [[__nodiscard__]]); /* { dg-error "ignored" } */
+
+[[nodiscard]] typedef int nod_int; /* { dg-error "can only be applied" } */
+
+[[nodiscard]] int nvar; /* { dg-error "can only be applied" } */
+
+struct s { int a; };
+
+[[nodiscard]] typedef struct s nod_s; /* { dg-error "can only be applied" } */
+
+struct t { [[nodiscard]] int b; }; /* { dg-error "can only be applied" } */
+
+enum e { E [[nodiscard]] }; /* { dg-error "can only be applied" } */
+
+void fx ([[nodiscard]] int p); /* { dg-error "can only be applied" } */
+
+void
+f (void)
+{
+ int a;
+ [[nodiscard ("reason")]] int b = 1; /* { dg-error "can only be applied" } */
+ [[nodiscard]]; /* { dg-error "ignored" } */
+ [[nodiscard]] a = 1; /* { dg-error "ignored" } */
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-3.c b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-3.c
new file mode 100644
index 0000000..2e70d12
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-3.c
@@ -0,0 +1,11 @@
+/* Test C2x nodiscard attribute: invalid syntax. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+[[nodiscard()]] int a (void); /* { dg-error "parentheses must be omitted if attribute argument list is empty" } */
+
+[[nodiscard(0)]] int b (void); /* { dg-error "expected" } */
+
+[[nodiscard("", 123)]] int c (void); /* { dg-error "expected" } */
+
+[[nodiscard((""))]] int d (void); /* { dg-error "expected" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-4.c b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-4.c
new file mode 100644
index 0000000..278f55d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-4.c
@@ -0,0 +1,6 @@
+/* Test C2x nodiscard attribute: duplicates (allowed after N2557). */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+[[nodiscard, __nodiscard__]] int f (void);
+[[__nodiscard__, nodiscard("message")]] int g (void);
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-syntax-3.c b/gcc/testsuite/gcc.dg/c2x-attr-syntax-3.c
index 1f883d8..2f0d9f6 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-syntax-3.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-syntax-3.c
@@ -25,13 +25,14 @@ f2 (void)
}
/* Declarations, including attribute declarations, cannot appear after
- labels. */
+ labels when a statement is expected. */
void
f3 (void)
{
- x: [[]];; /* { dg-error "can only be part of a statement" } */
-}
+ if (1)
+ x: [[]]; /* { dg-error "expected" } */
+}
/* Prefix attributes cannot appear on type names. */
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-syntax-5.c b/gcc/testsuite/gcc.dg/c2x-attr-syntax-5.c
index 37a2411..b261be0 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-syntax-5.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-syntax-5.c
@@ -49,8 +49,3 @@ func (void) [[unknown_attribute]] { /* { dg-error "attribute ignored" } */
[[unknown_attribute]] x: var = 2; /* { dg-error "attribute ignored" } */
for ([[unknown_attribute]] int zz = 1; zz < 10; zz++) ; /* { dg-error "attribute ignored" } */
}
-
-/* nodiscard is not yet implemented, but is a standard attribute, so
- its use is not a constraint violation and should only receive a
- warning. */
-[[nodiscard]] int ndfunc (void); /* { dg-warning "attribute directive ignored" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-bool-1.c b/gcc/testsuite/gcc.dg/c2x-bool-1.c
new file mode 100644
index 0000000..b64da1f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-bool-1.c
@@ -0,0 +1,50 @@
+/* Test macro expansions in <stdbool.h> in C2x. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#include <stdbool.h>
+
+#define str(x) xstr(x)
+#define xstr(x) #x
+
+extern void abort (void);
+extern void exit (int);
+extern int strcmp (const char *, const char *);
+
+#if false - 1 < 0
+#error "false signed in #if"
+#endif
+
+#if false != 0
+#error "false not 0 in #if"
+#endif
+
+#if true - 2 < 0
+#error "true signed in #if"
+#endif
+
+#if true != 1
+#error "true not 1 in #if"
+#endif
+
+int
+main (void)
+{
+ if (strcmp (str (bool), "_Bool") != 0)
+ abort ();
+ if (_Generic (true, _Bool : 1) != 1)
+ abort ();
+ if (true != 1)
+ abort ();
+ if (strcmp (str (true), "((_Bool)+1u)") != 0)
+ abort ();
+ if (_Generic (false, _Bool : 1) != 1)
+ abort ();
+ if (false != 0)
+ abort ();
+ if (strcmp (str (false), "((_Bool)+0u)") != 0)
+ abort ();
+ if (strcmp (str (__bool_true_false_are_defined), "1") != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-labels-1.c b/gcc/testsuite/gcc.dg/c2x-labels-1.c
new file mode 100644
index 0000000..439cf78
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-labels-1.c
@@ -0,0 +1,23 @@
+/* Tests for labels before declarations and at ends of compound statements. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+int f(int x)
+{
+ goto b;
+ a: int i = 2 * x;
+ aa: int u = 0; int v = 0;
+ goto c;
+ b: goto a;
+ { i *= 3; c: }
+ return i + u + v;
+ d:
+}
+
+int main(void)
+{
+ if (2 != f(1))
+ __builtin_abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-labels-2.c b/gcc/testsuite/gcc.dg/c2x-labels-2.c
new file mode 100644
index 0000000..bd010e9e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-labels-2.c
@@ -0,0 +1,15 @@
+/* Tests for labels before declarations and at ends of compound statements. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat" } */
+
+int f(int x)
+{
+ goto b;
+ a: int i = 2 * x; /* { dg-warning "a label can only be part of a statement and a declaration is not a statement" } */
+ goto c;
+ b: goto a;
+ { i *= 3; c: } /* { dg-warning "label at end of compound statement" } */
+ return i;
+ d: /* { dg-warning "label at end of compound statement" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/c2x-labels-3.c b/gcc/testsuite/gcc.dg/c2x-labels-3.c
new file mode 100644
index 0000000..159116d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-labels-3.c
@@ -0,0 +1,38 @@
+/* Tests for labels before declarations and at ends of compound statements
+ * in combination with attributes. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wall" } */
+
+int f(void)
+{
+ goto b;
+ a: int i = 0;
+ aa: __attribute__((unused)) int u = 0; int v = 0; /* { dg-warning "GNU-style attribute between label and declaration appertains to the label" } */
+ goto c;
+ { c: }
+ b: goto a;
+ return i + u + v;
+ d: __attribute__((unused)) (void)0;
+ e: __attribute__((unused))
+}
+
+int g(void)
+{
+ goto b;
+ a: int i = 0;
+ [[maybe_unused]] aa: int u = 0; int v = 0;
+ goto c;
+ { c: }
+ b: goto a;
+ return i + u + v;
+ [[maybe_unused]] d: (void)0;
+ [[maybe_unused]] e:
+}
+
+void h(void)
+{
+ [[maybe_unused]] a: [[maybe_unused]] b: [[maybe_unused]] int x;
+
+ if (1)
+ [[maybe_unused]] c: [[maybe_unused]] d: (void)0;
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-parm-omit-1.c b/gcc/testsuite/gcc.dg/c2x-parm-omit-1.c
new file mode 100644
index 0000000..0dc89bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-parm-omit-1.c
@@ -0,0 +1,5 @@
+/* Test omitted parameter names in C2x. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+void f (int) { }
diff --git a/gcc/testsuite/gcc.dg/c2x-parm-omit-2.c b/gcc/testsuite/gcc.dg/c2x-parm-omit-2.c
new file mode 100644
index 0000000..7d68933
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-parm-omit-2.c
@@ -0,0 +1,10 @@
+/* Test omitted parameter names in C2x. Warning test: there should be
+ no warning for an unnamed parameter being unused. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors -Wall -Wextra" } */
+
+int
+f (int a, int, int c, int d) /* { dg-warning "unused parameter 'd'" } */
+{
+ return a + c;
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-parm-omit-3.c b/gcc/testsuite/gcc.dg/c2x-parm-omit-3.c
new file mode 100644
index 0000000..dac258b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-parm-omit-3.c
@@ -0,0 +1,23 @@
+/* Test omitted parameter names in C2x. Execution test. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+extern void abort (void);
+extern void exit (int);
+
+void
+f (int a, int [++a], int b)
+{
+ /* Verify array size expression of unnamed parameter is processed as
+ expected. */
+ if (a != 2 || b != 3)
+ abort ();
+}
+
+int
+main (void)
+{
+ int t[2];
+ f (1, t, 3);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-parm-omit-4.c b/gcc/testsuite/gcc.dg/c2x-parm-omit-4.c
new file mode 100644
index 0000000..a4b0deb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-parm-omit-4.c
@@ -0,0 +1,5 @@
+/* Test omitted parameter names in C2x: diagnosed with -Wc11-c2x-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors -Wc11-c2x-compat" } */
+
+void f (int) { } /* { dg-warning "omitting parameter names" } */
diff --git a/gcc/testsuite/gcc.dg/c99-bool-4.c b/gcc/testsuite/gcc.dg/c99-bool-4.c
new file mode 100644
index 0000000..5cae18a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c99-bool-4.c
@@ -0,0 +1,46 @@
+/* Test macro expansions in <stdbool.h> in C99. */
+/* { dg-do run } */
+/* { dg-options "-std=c99 -pedantic-errors" } */
+
+#include <stdbool.h>
+
+#define str(x) xstr(x)
+#define xstr(x) #x
+
+extern void abort (void);
+extern void exit (int);
+extern int strcmp (const char *, const char *);
+
+#if false - 1 >= 0
+#error "false unsigned in #if"
+#endif
+
+#if false != 0
+#error "false not 0 in #if"
+#endif
+
+#if true - 2 >= 0
+#error "true unsigned in #if"
+#endif
+
+#if true != 1
+#error "true not 1 in #if"
+#endif
+
+int
+main (void)
+{
+ if (strcmp (str (bool), "_Bool") != 0)
+ abort ();
+ if (true != 1)
+ abort ();
+ if (strcmp (str (true), "1") != 0)
+ abort ();
+ if (false != 0)
+ abort ();
+ if (strcmp (str (false), "0") != 0)
+ abort ();
+ if (strcmp (str (__bool_true_false_are_defined), "1") != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/cpp/endif.c b/gcc/testsuite/gcc.dg/cpp/endif.c
deleted file mode 100644
index efea52c..0000000
--- a/gcc/testsuite/gcc.dg/cpp/endif.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc. */
-
-/* { dg-do preprocess } */
-
-/* Test case for PR preprocessor/6386 by Andreas Schwab. We'd back up
- over the CPP_EOF token (indicating not a funlike macro invocation)
- in the header file, which would then be passed through as a real
- EOF, leading to an early exit (and therefore bogus complaint about
- unterminated #if). */
-
-#define S(x)
-#if 1
-#include "endif.h"
-#endif
diff --git a/gcc/testsuite/gcc.dg/cpp/endif.h b/gcc/testsuite/gcc.dg/cpp/endif.h
deleted file mode 100644
index 3762249..0000000
--- a/gcc/testsuite/gcc.dg/cpp/endif.h
+++ /dev/null
@@ -1 +0,0 @@
-S
diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-link.c b/gcc/testsuite/gcc.dg/darwin-minversion-link.c
index 0a80048..765fb79 100644
--- a/gcc/testsuite/gcc.dg/darwin-minversion-link.c
+++ b/gcc/testsuite/gcc.dg/darwin-minversion-link.c
@@ -13,8 +13,9 @@
/* { dg-additional-options "-mmacosx-version-min=010.011.06 -DCHECK=101106" { target *-*-darwin15* } } */
/* { dg-additional-options "-mmacosx-version-min=010.012.06 -DCHECK=101206" { target *-*-darwin16* } } */
/* { dg-additional-options "-mmacosx-version-min=010.013.06 -DCHECK=101306" { target *-*-darwin17* } } */
-/* This next test covers 10.18 and (currently unreleased) 10.19 for now. */
-/* { dg-additional-options "-mmacosx-version-min=010.014.05 -DCHECK=101405" { target *-*-darwin1[89]* } } */
+/* { dg-additional-options "-mmacosx-version-min=010.014.05 -DCHECK=101405" { target *-*-darwin18* } } */
+/* { dg-additional-options "-mmacosx-version-min=010.015.06 -DCHECK=101506" { target *-*-darwin19* } } */
+/* { dg-additional-options "-mmacosx-version-min=011.000.00 -DCHECK=110000" { target *-*-darwin20 } } */
int
main ()
diff --git a/gcc/testsuite/gcc.dg/decl-9.c b/gcc/testsuite/gcc.dg/decl-9.c
index eeca8e0..9bb1560 100644
--- a/gcc/testsuite/gcc.dg/decl-9.c
+++ b/gcc/testsuite/gcc.dg/decl-9.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-std=gnu89" } */
+/* { dg-options "-std=gnu89 -pedantic-errors" } */
w *x; /* { dg-error "unknown type name 'w'" } */
@@ -12,6 +12,7 @@ int f1()
int d, e;
d * e; /* { dg-bogus "unknown type name 'd'" } */
g * h; /* { dg-error "unknown type name 'g'" } */
+ /* { dg-error "mixed declarations" "" { target *-*-* } .-1 } */
g i; /* { dg-error "unknown type name 'g'" } */
}
diff --git a/gcc/testsuite/gcc.dg/dfp/builtin-snan-1.c b/gcc/testsuite/gcc.dg/dfp/builtin-snan-1.c
new file mode 100644
index 0000000..49a32c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/builtin-snan-1.c
@@ -0,0 +1,23 @@
+/* Test __builtin_nansd* functions. Test not requiring runtime
+ exceptions support. */
+/* { dg-do run } */
+/* { dg-options "" } */
+
+volatile _Decimal32 d32 = __builtin_nansd32 ("");
+volatile _Decimal64 d64 = __builtin_nansd64 ("");
+volatile _Decimal128 d128 = __builtin_nansd128 ("");
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+ if (!__builtin_isnan (d32))
+ abort ();
+ if (!__builtin_isnan (d64))
+ abort ();
+ if (!__builtin_isnan (d128))
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/builtin-snan-2.c b/gcc/testsuite/gcc.dg/dfp/builtin-snan-2.c
new file mode 100644
index 0000000..248481b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/builtin-snan-2.c
@@ -0,0 +1,44 @@
+/* Test __builtin_nansd* functions. Test requiring runtime exceptions
+ support. */
+/* { dg-do run } */
+/* { dg-require-effective-target fenv_exceptions_dfp } */
+/* { dg-options "" } */
+
+#include <fenv.h>
+
+volatile _Decimal32 d32 = __builtin_nansd32 ("");
+volatile _Decimal64 d64 = __builtin_nansd64 ("");
+volatile _Decimal128 d128 = __builtin_nansd128 ("");
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+ feclearexcept (FE_ALL_EXCEPT);
+ d32 += d32;
+ if (!fetestexcept (FE_INVALID))
+ abort ();
+ feclearexcept (FE_ALL_EXCEPT);
+ d32 += d32;
+ if (fetestexcept (FE_INVALID))
+ abort ();
+ feclearexcept (FE_ALL_EXCEPT);
+ d64 += d64;
+ if (!fetestexcept (FE_INVALID))
+ abort ();
+ feclearexcept (FE_ALL_EXCEPT);
+ d64 += d64;
+ if (fetestexcept (FE_INVALID))
+ abort ();
+ feclearexcept (FE_ALL_EXCEPT);
+ d128 += d128;
+ if (!fetestexcept (FE_INVALID))
+ abort ();
+ feclearexcept (FE_ALL_EXCEPT);
+ d128 += d128;
+ if (fetestexcept (FE_INVALID))
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/pr97439.c b/gcc/testsuite/gcc.dg/dfp/pr97439.c
new file mode 100644
index 0000000..7fcf834
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pr97439.c
@@ -0,0 +1,27 @@
+// { dg-do run }
+// { dg-options "-O1" }
+
+static int
+foo(_Decimal128 x, _Decimal128 y)
+{
+ if (x > y)
+ return 1;
+
+ return 0;
+}
+
+int __attribute__((noinline))
+bar(_Decimal128 x)
+{
+ return foo (x, -1.0DL * __builtin_infd32());
+}
+
+int
+main (void)
+{
+ int res = bar (0.0DL);
+ if (res != 1)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/barrier-2.c b/gcc/testsuite/gcc.dg/gomp/barrier-2.c
index 5a70919..c0d62f5 100644
--- a/gcc/testsuite/gcc.dg/gomp/barrier-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/barrier-2.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-options "-Wall -std=c17 -fopenmp -pedantic-errors" } */
void f1(void)
{
@@ -16,6 +17,7 @@ void f1(void)
void f2(void)
{
label: /* { dg-error "label at end of compound statement" } */
+ /* { dg-warning "defined but not used" "" { target *-*-* } .-1 } */
#pragma omp barrier /* { dg-error "may only be used in compound statements" } */
}
diff --git a/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c b/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c
index fe23652..b9a4161 100644
--- a/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c
+++ b/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c
@@ -1,5 +1,6 @@
/* Test parsing of #pragma omp declare simd */
/* { dg-do compile } */
+/* { dg-options "-std=c17 -fopenmp -pedantic-errors" } */
int
f1 (int x)
@@ -14,7 +15,7 @@ f1 (int x)
lab:
#pragma omp declare simd simdlen (8) aligned (b : 8 * sizeof (int))
extern int f5 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
- x++; /* { dg-error "expected expression before" "" { target *-*-* } .-1 } */
+ x++; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" "" { target *-*-* } .-1 } */
}
return x;
}
diff --git a/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c b/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c
index 701d83b..39c2c1d 100644
--- a/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c
@@ -1,5 +1,6 @@
/* Test parsing of #pragma omp declare variant */
/* { dg-do compile } */
+/* { dg-options "-std=c17 -fopenmp -pedantic-errors" } */
int f0 (int, int *, int);
@@ -16,7 +17,7 @@ f1 (int x)
lab:
#pragma omp declare variant (fn0) match (user={condition(0)})
extern int f5 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
- x++; /* { dg-error "expected expression before" "" { target *-*-* } .-1 } */
+ x++; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" "" { target *-*-* } .-1 } */
}
return x;
}
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
index 89cd896..ba87132 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -38,7 +38,7 @@ global GDB
if ![info exists ::env(GUALITY_GDB_NAME)] {
if [info exists GDB] {
set guality_gdb_name "$GDB"
- } elseif [file exists $rootme/../gdb/gdb] {
+ } elseif { [info exists rootme] && [file exists $rootme/../gdb/gdb] } {
# If we're doing a combined build, and gdb is available, use it.
set guality_gdb_name "$rootme/../gdb/gdb"
} else {
diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-5.c b/gcc/testsuite/gcc.dg/ipa/inlinehint-5.c
new file mode 100644
index 0000000..218f805
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-5.c
@@ -0,0 +1,36 @@
+/* { dg-options "-O2 -fdump-ipa-inline-details -fno-early-inlining " } */
+/* { dg-add-options bind_pic_locally } */
+int j,k,l;
+int test3(int);
+int test4(int);
+
+static inline int
+test2(int i)
+{
+ if (__builtin_constant_p (i))
+ {
+ switch (i)
+ {
+ case 1: return j;
+ case 2: return k;
+ case 3: return l;
+ }
+ }
+ else return test3(i)+test4(i);
+}
+
+static inline int
+test (int i)
+{
+ return test2(i) + test2(i+1) + test3 (i) + test3(i) + test3(i) + test3 (i);
+}
+
+int
+run (int i)
+{
+ return test (i) + test (i);
+}
+/* The test should work by first inlining test2->test and then test to run
+ Both are called twice, so 4 hints (the second make sure that we propagate
+ to callers. */
+/* { dg-final { scan-ipa-dump-times "hints: declared_inline builtin_constant_p" 4 "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/modref-1.c b/gcc/testsuite/gcc.dg/ipa/modref-1.c
new file mode 100644
index 0000000..858567d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/modref-1.c
@@ -0,0 +1,24 @@
+/* { dg-options "-O2 -fdump-ipa-modref" } */
+/* { dg-do compile } */
+__attribute__((noinline))
+void a(char *ptr, char *ptr2)
+{
+ (*ptr)++;
+ (*ptr2)++;
+}
+
+__attribute__((noinline))
+void b(char *ptr)
+{
+ a(ptr+1,&ptr[2]);
+}
+
+int main()
+{
+ char c[3]={0,1,0};
+ b(c);
+ return c[0]+c[2];
+}
+/* Check that both param offsets are determined correctly. */
+/* { dg-final { scan-ipa-dump "param offset:1" "modref" } } */
+/* { dg-final { scan-ipa-dump "param offset:2" "modref" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/modref-2.c b/gcc/testsuite/gcc.dg/ipa/modref-2.c
new file mode 100644
index 0000000..5ac2c65
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/modref-2.c
@@ -0,0 +1,15 @@
+/* { dg-options "-O2 -fdump-ipa-modref" } */
+/* { dg-do compile } */
+void
+test (int *a, int size)
+{
+ __builtin_memset (a, 0, 321);
+}
+void
+test2 (double x, double *y)
+{
+ __builtin_modf (x,y);
+}
+/* 321*8 */
+/* { dg-final { scan-ipa-dump "Parm 0 param offset:0 offset:0 size:-1 max_size:2568" "modref" } } */
+/* { dg-final { scan-ipa-dump "Parm 1 param offset:0 offset:0 size:-1 max_size:64" "modref" } } */
diff --git a/gcc/testsuite/gcc.dg/label-compound-stmt-1.c b/gcc/testsuite/gcc.dg/label-compound-stmt-1.c
index 2f8fa4e..2ae2b82 100644
--- a/gcc/testsuite/gcc.dg/label-compound-stmt-1.c
+++ b/gcc/testsuite/gcc.dg/label-compound-stmt-1.c
@@ -1,7 +1,7 @@
/* Test that labels at ends of compound statements are hard errors. */
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
/* { dg-do compile } */
-/* { dg-options "" } */
+/* { dg-options "-std=c17 -pedantic-errors" } */
void f(void) { g: } /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "label|parse|syntax" "label at end of compound statement" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/lto/modref-2_0.c b/gcc/testsuite/gcc.dg/lto/modref-2_0.c
new file mode 100644
index 0000000..cf84ed9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/modref-2_0.c
@@ -0,0 +1,27 @@
+/* { dg-lto-do run } */
+/* { dg-lto-options {"-O2 -flto-partition=max -flto -fno-ipa-sra"} } */
+__attribute__ ((noinline))
+void
+test (char *a)
+{
+ __builtin_memset (a,0,321);
+}
+__attribute__ ((noinline))
+void
+test2 (double *x, double *y)
+{
+ __builtin_modf (*x,y);
+}
+int
+main (void)
+{
+ char array[321];
+ double x=1, y=2;
+ char arrayz[321];
+ arrayz[0]=1;
+ test (array);
+ test2 (&x,&y);
+ if (!__builtin_constant_p (x==2) || !__builtin_constant_p (arrayz[0]==1))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/no-strict-overflow-4.c b/gcc/testsuite/gcc.dg/no-strict-overflow-4.c
index b6d3da3..90145ff9 100644
--- a/gcc/testsuite/gcc.dg/no-strict-overflow-4.c
+++ b/gcc/testsuite/gcc.dg/no-strict-overflow-4.c
@@ -4,7 +4,8 @@
/* Source: Ian Lance Taylor. Dual of strict-overflow-4.c. */
/* We can only simplify the conditional when using strict overflow
- semantics. */
+ semantics or when using wrap overflow semantics. -fno-strict-overflow is
+ equivalent to -fwrapv. */
int
foo (int i)
@@ -12,4 +13,4 @@ foo (int i)
return i + 1 > i;
}
-/* { dg-final { scan-tree-dump "\[^ \]*_.(\\\(D\\\))? (>|<) \[^ \]*_." "optimized" } } */
+/* { dg-final { scan-tree-dump "\[^ \]*_.(\\\(D\\\))? != \[0-9]+" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr79758.c b/gcc/testsuite/gcc.dg/noncompile/pr79758.c
index aeaf7c7..a312160 100644
--- a/gcc/testsuite/gcc.dg/noncompile/pr79758.c
+++ b/gcc/testsuite/gcc.dg/noncompile/pr79758.c
@@ -1,6 +1,6 @@
/* PR c/79758 */
/* { dg-do compile } */
-void fn1 (int[a]) { }; /* { dg-error "undeclared here|parameter name omitted" } */
+void fn1 (int[a]) { }; /* { dg-error "undeclared here" } */
void fn1 (b) { }; /* { dg-error "redefinition" } */
/* { dg-warning "defaults to 'int'" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/parse-decl-after-label.c b/gcc/testsuite/gcc.dg/parse-decl-after-label.c
index 9c9886a..6e2a047e 100644
--- a/gcc/testsuite/gcc.dg/parse-decl-after-label.c
+++ b/gcc/testsuite/gcc.dg/parse-decl-after-label.c
@@ -1,6 +1,6 @@
/* PR 29062
{ dg-do compile }
-{ dg-options "-fsyntax-only" }
+{ dg-options "-std=c17 -pedantic-errors -fsyntax-only" }
*/
int f(int x)
diff --git a/gcc/testsuite/gcc.dg/pr36093.c b/gcc/testsuite/gcc.dg/pr36093.c
new file mode 100644
index 0000000..8474641
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36093.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-skip-if "small alignment" { pdp11-*-* } } */
+
+extern void abort (void);
+
+typedef struct Bar {
+ char c[129];
+} Bar __attribute__((__aligned__(128)));
+
+typedef struct Foo {
+ Bar bar[4]; /* { dg-error "size of array element is not a multiple of its alignment" } */
+} Foo;
+
+Foo foo[4];
+
+int main()
+{
+ int i, j;
+ Foo *foop = &foo[0];
+
+ for (i=0; i < 4; i++) {
+ Bar *bar = &foop->bar[i];
+ for (j=0; j < 129; j++) {
+ bar->c[j] = 'a' + i;
+ }
+ }
+
+ if (foo[0].bar[3].c[128] != 'd')
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr43783.c b/gcc/testsuite/gcc.dg/pr43783.c
new file mode 100644
index 0000000..196735b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr43783.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+/* { dg-skip-if "small alignment" { pdp11-*-* } } */
+
+typedef __attribute__((aligned(16)))
+struct {
+ unsigned long long w[3];
+} UINT192;
+
+UINT192 bid_Kx192[32]; /* { dg-error "size of array element is not a multiple of its alignment" } */
+
+extern void abort (void);
+
+int main()
+{
+ int i = 0;
+ unsigned long x = 0;
+ for (i = 0; i < 32; ++i)
+ bid_Kx192[i].w[1] = i == 1;
+ for (i = 0; i < 32; ++i)
+ x += bid_Kx192[1].w[1];
+ if (x != 32)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr66552.c b/gcc/testsuite/gcc.dg/pr66552.c
new file mode 100644
index 0000000..7583c9a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr66552.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lower" } */
+
+unsigned a(unsigned x, int n)
+{
+ return x >> (n % 32);
+}
+
+unsigned b(unsigned x, int n)
+{
+ return x << (n % 32);
+}
+
+/* { dg-final { scan-tree-dump-not " % " "lower" } } */
diff --git a/gcc/testsuite/gcc.dg/pr68671.c b/gcc/testsuite/gcc.dg/pr68671.c
index 9b473ca..bec4639 100644
--- a/gcc/testsuite/gcc.dg/pr68671.c
+++ b/gcc/testsuite/gcc.dg/pr68671.c
@@ -1,7 +1,6 @@
/* PR tree-optimization/68671 */
/* { dg-do run } */
/* { dg-options " -O2 -fno-tree-dce" } */
-/* { dg-xfail-if "ptxas crashes" { nvptx-*-* } } */
volatile int a = -1;
volatile int b;
diff --git a/gcc/testsuite/gcc.dg/pr91441.c b/gcc/testsuite/gcc.dg/pr91441.c
new file mode 100644
index 0000000..4f7a8fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr91441.c
@@ -0,0 +1,11 @@
+/* PR target/91441 */
+/* { dg-do compile } */
+/* { dg-require-effective-target no_fsanitize_address }*/
+/* { dg-options "--param asan-stack=1 -fsanitize=kernel-address" } */
+
+int *bar(int *);
+int *f( int a)
+{
+ return bar(&a);
+}
+/* { dg-warning ".'-fsanitize=kernel-address' with stack protection is not supported without '-fasan-shadow-offset=' for this target" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/pr96260.c b/gcc/testsuite/gcc.dg/pr96260.c
new file mode 100644
index 0000000..734832f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr96260.c
@@ -0,0 +1,10 @@
+/* PR target/96260 */
+/* { dg-do compile } */
+/* { dg-require-effective-target no_fsanitize_address }*/
+/* { dg-options "--param asan-stack=1 -fsanitize=kernel-address -fasan-shadow-offset=0x100000" } */
+
+int *bar(int *);
+int *f( int a)
+{
+ return bar(&a);
+}
diff --git a/gcc/testsuite/gcc.dg/pr96307.c b/gcc/testsuite/gcc.dg/pr96307.c
new file mode 100644
index 0000000..cd1c17c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr96307.c
@@ -0,0 +1,25 @@
+/* PR target/96307 */
+/* { dg-do compile } */
+/* { dg-require-effective-target no_fsanitize_address }*/
+/* { dg-additional-options "-fsanitize=kernel-address --param=asan-instrumentation-with-call-threshold=8" } */
+
+#include <limits.h>
+enum a {test1, test2, test3=INT_MAX};
+enum a a;
+enum a *b;
+
+void reset (void);
+
+void
+t()
+{
+ if (a != test2)
+ __builtin_abort ();
+ if (*b != test2)
+ __builtin_abort ();
+ reset ();
+ if (a != test1)
+ __builtin_abort ();
+ if (*b != test1)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr97360-2.c b/gcc/testsuite/gcc.dg/pr97360-2.c
new file mode 100644
index 0000000..48aebf1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97360-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 " } */
+
+void *a;
+void *b(void);
+void *e(void);
+
+void *
+c() {
+ void *d;
+ if (d == b && e())
+ d = a;
+ return d;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97378.c b/gcc/testsuite/gcc.dg/pr97378.c
new file mode 100644
index 0000000..27e4a1f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97378.c
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+int a, b, c;
+void d() {
+e : {
+ long f;
+ long *g = &f;
+ if ((a != 0) - (b = 0))
+ ;
+ else
+ a &= (*g %= a *= c) >= (*g || f);
+ goto e;
+}
+}
diff --git a/gcc/testsuite/gcc.dg/pr97381.c b/gcc/testsuite/gcc.dg/pr97381.c
new file mode 100644
index 0000000..947692c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97381.c
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+int a;
+void b() {
+ char c = 27;
+ for (; c <= 85; c += 1) {
+ a /= 148372120 * c;
+ if (a)
+ for (;;)
+ ;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr97396.c b/gcc/testsuite/gcc.dg/pr97396.c
new file mode 100644
index 0000000..d992c11
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97396.c
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-O1 -ftree-vrp" }
+// { dg-additional-options "-m32" { target { i?86-*-* x86_64-*-* } } }
+
+unsigned int
+po (char *os, unsigned int al)
+{
+ for (;;)
+ {
+ int qx = 0;
+
+ while (al < 1)
+ {
+ char *cw;
+
+ cw = os + qx;
+ if (cw)
+ return al + qx;
+
+ qx += sizeof *cw;
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr97462.c b/gcc/testsuite/gcc.dg/pr97462.c
new file mode 100644
index 0000000..52c0533
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97462.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -w" } */
+
+int a, b;
+
+void d ()
+{
+ a << ~0 && b;
+ b = a;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97463.c b/gcc/testsuite/gcc.dg/pr97463.c
new file mode 100644
index 0000000..f93b07c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97463.c
@@ -0,0 +1,7 @@
+/* PR c/97463 - ICE in warn_parm_ptrarray_mismatch on an incompatible
+ function redeclaration
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+void f (void**);
+void f (int n) { } // { dg-error "conflicting types" }
diff --git a/gcc/testsuite/gcc.dg/pr97467.c b/gcc/testsuite/gcc.dg/pr97467.c
new file mode 100644
index 0000000..dcbd218
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97467.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-Os" } */
+
+int a;
+long b;
+unsigned int c = 1;
+
+int main () {
+ int e;
+ for (; c <= 0; c++) {
+ int f = 0;
+ b = e;
+ a = f || b << c;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97488.c b/gcc/testsuite/gcc.dg/pr97488.c
new file mode 100644
index 0000000..de7396c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97488.c
@@ -0,0 +1,11 @@
+// { dg-do compile { target int128 } }
+// { dg-options "-O1 -ftree-vrp" }
+
+__int128
+ef (__int128 ms)
+{
+ int dh = 129;
+ int *hj = &dh;
+
+ return ms << *hj ? ms : 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97501.c b/gcc/testsuite/gcc.dg/pr97501.c
new file mode 100644
index 0000000..aedac83
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97501.c
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+static int c = 0;
+
+int main() {
+ int b = 0;
+ if (c) {
+ for (;; b--)
+ do
+ b++;
+ while (b);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr97502.c b/gcc/testsuite/gcc.dg/pr97502.c
new file mode 100644
index 0000000..d87af9c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97502.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+extern char v[54];
+void bar (char *);
+void
+foo (void)
+{
+ int i;
+ char c[32];
+ bar (c);
+ for (i = 0; i < 32; i++)
+ c[i] = c[i] && !v[i];
+ bar (c);
+}
diff --git a/gcc/testsuite/gcc.dg/pr97505.c b/gcc/testsuite/gcc.dg/pr97505.c
new file mode 100644
index 0000000..f01d912
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97505.c
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-Os -fsanitize=signed-integer-overflow -fdump-tree-evrp" }
+
+// Test that .UBSAN_CHECK_SUB(y, x) is treated as y-x for range
+// purposes, where X and Y are related to each other.
+//
+// This effectively checks that range relationals work with builtins.
+
+void unreachable();
+
+int foobar(int x, int y)
+{
+ if (x < y)
+ {
+ int z = y - x;
+ if (z == 0)
+ unreachable();
+ return z;
+ }
+ return 5;
+}
+
+// { dg-final { scan-tree-dump-not "unreachable" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/pr97515.c b/gcc/testsuite/gcc.dg/pr97515.c
new file mode 100644
index 0000000..84f145a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97515.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+int
+e7 (int gg)
+{
+ int xe = 0;
+
+ while (xe < 1)
+ {
+ int ui;
+
+ ui = ~xe;
+ if (ui == 0)
+ ui = xe >> gg;
+
+ xe %= !ui;
+ }
+
+ return xe;
+}
+
+/* EVRP should be able to reduce this to a single goto. */
+
+/* { dg-final { scan-tree-dump-times "goto" 1 "evrp" } } */
diff --git a/gcc/testsuite/gcc.dg/pr97520.c b/gcc/testsuite/gcc.dg/pr97520.c
new file mode 100644
index 0000000..9f66595
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97520.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-fre" } */
+
+char a;
+void b() {
+ char *c[5];
+ char *d = &a;
+ &d;
+ *(c[4] = d);
+}
+int main() { return 0; }
diff --git a/gcc/testsuite/gcc.dg/pr97539.c b/gcc/testsuite/gcc.dg/pr97539.c
new file mode 100644
index 0000000..def55e1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97539.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -g" } */
+
+int a, b;
+void c() {
+ char d;
+ for (; b;)
+ for (;;)
+ for (; d <= 7; d += 1) {
+ a = 7;
+ for (; a; a += 1)
+ e:
+ d += d;
+ d ^= 0;
+ }
+ goto e;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97555.c b/gcc/testsuite/gcc.dg/pr97555.c
new file mode 100644
index 0000000..625bc6f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97555.c
@@ -0,0 +1,22 @@
+// { dg-do run }
+// { dg-options "-Os" }
+
+struct {
+ int a:1;
+} b;
+
+int c, d, e, f = 1, g;
+
+int main ()
+{
+ for (; d < 3; d++) {
+ char h = 1 % f, i = ~(0 || ~0);
+ c = h;
+ f = ~b.a;
+ ~b.a | 1 ^ ~i && g;
+ if (~e)
+ i = b.a;
+ b.a = i;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97567-2.c b/gcc/testsuite/gcc.dg/pr97567-2.c
new file mode 100644
index 0000000..dee31c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97567-2.c
@@ -0,0 +1,24 @@
+/* { dg-do compile} */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+char a[2];
+
+extern int x;
+
+void foo(void);
+
+signed char g (signed char min, signed char max)
+{
+ signed char i = x;
+ return i < min || max < i ? min : i;
+}
+
+void gg (void)
+{
+ signed char t = g (0, 9);
+ /* Ranger should be able to remove the call to foo (). */
+ if (t > 9 || t < 0)
+ foo ();
+}
+
+/* { dg-final { scan-tree-dump-not "foo" "evrp" } } */
diff --git a/gcc/testsuite/gcc.dg/pr97567.c b/gcc/testsuite/gcc.dg/pr97567.c
new file mode 100644
index 0000000..8922f27
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97567.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+int a, b, c, d;
+void k() {
+ unsigned f = 1;
+ long long g = 4073709551615;
+ for (; a; a++)
+ for (;;) {
+ d = 0;
+ L1:
+ break;
+ }
+ if (f)
+ for (; a; a++)
+ ;
+ g || f;
+ int i = 0 - f || g;
+ long long j = g - f;
+ if (j || f) {
+ if (g < 4073709551615)
+ for (;;)
+ ;
+ int e = ~f, h = b / ~e;
+ if (c)
+ goto L2;
+ g = f = h;
+ }
+ g || d;
+L2:
+ if (c)
+ goto L1;
+}
+int main() { k(); return 0; }
diff --git a/gcc/testsuite/gcc.dg/pr97596.c b/gcc/testsuite/gcc.dg/pr97596.c
new file mode 100644
index 0000000..b0726ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97596.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2" } */
+
+void
+q8 (__int128 *uv, unsigned short int nf)
+{
+ __int128 i4;
+
+ i4 = -nf;
+ if (i4 << 1 != 0)
+ *uv += nf;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97721.c b/gcc/testsuite/gcc.dg/pr97721.c
new file mode 100644
index 0000000..c2a2848
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97721.c
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-O -fno-tree-dominator-opts" }
+
+int ot;
+
+void
+z6 (char *tw)
+{
+ while (ot >= 0)
+ --ot;
+
+ __builtin_strcpy (&tw[ot], tw);
+}
diff --git a/gcc/testsuite/gcc.dg/pr97725.c b/gcc/testsuite/gcc.dg/pr97725.c
new file mode 100644
index 0000000..2fcb12c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97725.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a;
+unsigned b;
+
+int main() {
+ if (a) {
+ goto L1;
+ while (1)
+ while (1) {
+ long e = -1L, g;
+ int f, h, i;
+ L1:
+ a = f;
+ L2:
+ g = e;
+ f = h || g;
+ e = ~(f & b);
+ if (i || g < -1L) {
+ ~(g || 0);
+ break;
+ }
+ goto L2;
+ }
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97737.c b/gcc/testsuite/gcc.dg/pr97737.c
new file mode 100644
index 0000000..eef1c35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97737.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a = 1, b, c;
+
+void d() {
+ int e = 1;
+L1:
+ b = e;
+L2:
+ e = e / a;
+ if (!(e || c || e - 1))
+ goto L1;
+ if (!b)
+ goto L2;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97741.c b/gcc/testsuite/gcc.dg/pr97741.c
new file mode 100644
index 0000000..47115d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97741.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wextra -fno-strict-aliasing -fwrapv -Os -fno-toplevel-reorder -fno-tree-ccp -fno-tree-fre" } */
+
+short a = 0;
+long b = 0;
+char c = 0;
+void d() {
+ int e = 0;
+f:
+ for (a = 6; a;)
+ c = e;
+ e = 0;
+ for (; e == 20; ++e)
+ for (; b;)
+ goto f;
+}
+int main() { return 0; }
diff --git a/gcc/testsuite/gcc.dg/pragma-diag-6.c b/gcc/testsuite/gcc.dg/pragma-diag-6.c
index 0dca1dc..f2df88d 100644
--- a/gcc/testsuite/gcc.dg/pragma-diag-6.c
+++ b/gcc/testsuite/gcc.dg/pragma-diag-6.c
@@ -2,7 +2,10 @@
#pragma GCC diagnostic error "-Wnoexcept" /* { dg-warning "is valid for C../ObjC.. but not for C" } */
#pragma GCC diagnostic error "-fstrict-aliasing" /* { dg-warning "not an option that controls warnings" } */
#pragma GCC diagnostic error "-Werror" /* { dg-warning "not an option that controls warnings" } */
-#pragma GCC diagnostic error "-Wvla2" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind; did you mean '-Wvla'" } */
-#pragma GCC diagnostic error "-Walla" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind; did you mean '-Wall'" } */
-#pragma GCC diagnostic warning "-Walla" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind; did you mean '-Wall'" } */
+#pragma GCC diagnostic error "-Wvla2" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind" } */
+/* { dg-message "did you mean '-Wvla'" "" { target *-*-* } .-1 } */
+#pragma GCC diagnostic error "-Walla" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind" } */
+/* { dg-message "did you mean '-Wall'" "" { target *-*-* } .-1 } */
+#pragma GCC diagnostic warning "-Walla" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind" } */
+/* { dg-message "did you mean '-Wall'" "" { target *-*-* } .-1 } */
int i;
diff --git a/gcc/testsuite/gcc.dg/self-right-shift.c b/gcc/testsuite/gcc.dg/self-right-shift.c
new file mode 100644
index 0000000..c457ee5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/self-right-shift.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+/* Self right-shift should be optimized to 0. */
+
+int
+foo (int i)
+{
+ return i >> i;
+}
+
+/* { dg-final { scan-tree-dump "return 0;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/sin_cos.c b/gcc/testsuite/gcc.dg/sin_cos.c
new file mode 100644
index 0000000..aa71dca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sin_cos.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* This maps to essentially the same gimple that is generated for
+ gnat.dg/sin_cos.adb, on platforms that use the wraplf variant of
+ Ada.Numerics.Aux_Float. The value of EPSILON is not relevant to
+ the test, but the test must be there to keep the conversions in
+ different BBs long enough to trigger the problem that prevented the
+ sincos optimization, because the arguments passed to sin and cos
+ didn't get unified into a single SSA_NAME in time for sincos. */
+
+#include <math.h>
+
+#define EPSILON 3.4526697709225118160247802734375e-4
+
+static float my_sinf(float x) {
+ return (float) sin ((double) x);
+}
+
+static float wrap_sinf(float x) {
+ if (fabs (x) < EPSILON)
+ return 0;
+ return my_sinf (x);
+}
+
+static float my_cosf(float x) {
+ return (float) cos ((double) x);
+}
+
+static float wrap_cosf(float x) {
+ if (fabs (x) < EPSILON)
+ return 1;
+ return my_cosf (x);
+}
+
+float my_sin_cos(float x, float *s, float *c) {
+ *s = wrap_sinf (x);
+ *c = wrap_cosf (x);
+}
+
+/* { dg-final { scan-assembler "sincos\|cexp" { target *-linux-gnu* *-w64-mingw* *-*-vxworks* } } } */
diff --git a/gcc/testsuite/gcc.dg/sms-12.c b/gcc/testsuite/gcc.dg/sms-12.c
index aef32ee..3ec50f2 100644
--- a/gcc/testsuite/gcc.dg/sms-12.c
+++ b/gcc/testsuite/gcc.dg/sms-12.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-skip-if "" { ! { aarch64*-*-* } } } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fmodulo-sched -funroll-loops -fdump-rtl-sms --param sms-min-sc=1 -fmodulo-sched-allow-regmoves -fPIC" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr97461.c b/gcc/testsuite/gcc.dg/tree-prof/pr97461.c
new file mode 100644
index 0000000..213fac9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/pr97461.c
@@ -0,0 +1,64 @@
+/* PR gcov-profile/97461 */
+/* { dg-options "-O2 -ldl" } */
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int malloc_depth = 0;
+
+static char memory[128* 1024];
+static size_t memory_p = 0;
+
+void f1(void) {}
+void f2(void) {}
+
+typedef void (*fun_t)(void);
+static const fun_t funs[2] = { f1, f2, };
+
+static void * malloc_impl(size_t size) {
+ void * r = &memory[memory_p];
+ /* The malloc() and calloc() functions return a pointer to the allocated
+ * memory, which is suitably aligned for any built-in type. Use 16
+ * bytes here as the basic alignment requirement for user-defined malloc
+ * and calloc. See PR97594 for the details. */
+ #define ROUND_UP_FOR_16B_ALIGNMENT(x) ((x + 15) & (-16))
+
+ memory_p += ROUND_UP_FOR_16B_ALIGNMENT(size);
+
+ // force TOPN profile
+ funs[size % 2]();
+ return r;
+}
+
+// Override default malloc, check it it get s called recursively
+void * malloc(size_t size) {
+ // Must not be called recursively. Malloc implementation does not support it.
+ if (malloc_depth != 0) __builtin_trap();
+
+ ++malloc_depth;
+ void * r = malloc_impl(size);
+ --malloc_depth;
+ return r;
+}
+
+// Called from gcov
+void *calloc(size_t nmemb, size_t size) {
+ // Must not be called recursively. Malloc implementation does not support it.
+ if (malloc_depth != 0) __builtin_trap();
+
+ ++malloc_depth;
+ void * r = malloc_impl(size * nmemb);
+ memset(r, 0, size * nmemb);
+ --malloc_depth;
+ return r;
+}
+
+void free(void *ptr){}
+
+int main() {
+ void * p = malloc(8);
+ return p != 0 ? 0 : 1;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c
index b7d50ec..b9f8fd2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c
@@ -33,4 +33,4 @@ void test55 (int x, int y)
that the && should be emitted (based on BRANCH_COST). Fix this
by teaching dom to look through && and register all components
as true. */
-/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail { ! "alpha*-*-* arm*-*-* aarch64*-*-* powerpc*-*-* cris-*-* hppa*-*-* i?86-*-* mmix-*-* mips*-*-* m68k*-*-* moxie-*-* nds32*-*-* s390*-*-* sh*-*-* sparc*-*-* visium-*-* x86_64-*-* riscv*-*-* or1k*-*-* msp430-*-* pru*-*-*" } } } } */
+/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail { ! "alpha*-*-* arm*-*-* aarch64*-*-* powerpc*-*-* cris-*-* hppa*-*-* i?86-*-* mmix-*-* mips*-*-* m68k*-*-* moxie-*-* nds32*-*-* s390*-*-* sh*-*-* sparc*-*-* visium-*-* x86_64-*-* riscv*-*-* or1k*-*-* msp430-*-* pru*-*-* nvptx*-*-*" } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c
new file mode 100644
index 0000000..3ac217b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c
@@ -0,0 +1,26 @@
+/* { dg-options "-O2 -fdump-tree-modref1" } */
+/* { dg-do compile } */
+__attribute__((noinline))
+void a(char *ptr, char *ptr2)
+{
+ (*ptr)++;
+ (*ptr2)++;
+}
+
+__attribute__((noinline))
+void b(char *ptr)
+{
+ a(ptr+1,&ptr[2]);
+}
+
+int main()
+{
+ char c[4]={0,1,2,0};
+ b(c);
+ return c[0]+c[3];
+}
+/* Check that both param offsets are determined correctly and the computation
+ is optimized out. */
+/* { dg-final { scan-tree-dump "param offset:1" "modref1" } } */
+/* { dg-final { scan-tree-dump "param offset:2" "modref1" } } */
+/* { dg-final { scan-tree-dump "return 0" "modref1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c
new file mode 100644
index 0000000..fd37066
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c
@@ -0,0 +1,11 @@
+/* PR tree-optimization/97690 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-phiopt2" } */
+
+int foo (_Bool d) { return d ? 2 : 0; }
+int bar (_Bool d) { return d ? 1 : 0; }
+int baz (_Bool d) { return d ? -__INT_MAX__ - 1 : 0; }
+int qux (_Bool d) { return d ? 1024 : 0; }
+
+/* { dg-final { scan-tree-dump-not "if" "phiopt2" } } */
+/* { dg-final { scan-tree-dump-times " << " 3 "phiopt2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr71077.c b/gcc/testsuite/gcc.dg/tree-ssa/pr71077.c
index 4753740..259055f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr71077.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr71077.c
@@ -1,5 +1,6 @@
/* PR c++/71077 */
/* { dg-do link { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-require-effective-target lto } */
/* { dg-options "-O3 -flto -march=core-avx2" } */
int *a;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c b/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c
index 48d829a..3c02701 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c
@@ -13,4 +13,4 @@ int foo()
}
/* Listed targets xfailed due to PR84958. */
-/* { dg-final { scan-tree-dump "return 285;" "optimized" { xfail { amdgcn*-*-* nvptx*-*-* } } } } */
+/* { dg-final { scan-tree-dump "return 285;" "optimized" { xfail { amdgcn*-*-* } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c b/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c
new file mode 100644
index 0000000..d6139a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c
@@ -0,0 +1,58 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -funroll-loops -ftree-vectorize -fdump-tree-dse-details" } */
+
+/* Test if scalar cleanup pass takes effects, mainly check
+ its secondary pass DSE can remove dead stores on array
+ tmp. */
+
+#include "stdint.h"
+
+static inline void
+foo (int16_t *diff, int i_size, uint8_t *val1, int i_val1, uint8_t *val2,
+ int i_val2)
+{
+ for (int y = 0; y < i_size; y++)
+ {
+ for (int x = 0; x < i_size; x++)
+ diff[x + y * i_size] = val1[x] - val2[x];
+ val1 += i_val1;
+ val2 += i_val2;
+ }
+}
+
+void
+bar (int16_t res[16], uint8_t *val1, uint8_t *val2)
+{
+ int16_t d[16];
+ int16_t tmp[16];
+
+ foo (d, 4, val1, 16, val2, 32);
+
+ for (int i = 0; i < 4; i++)
+ {
+ int s03 = d[i * 4 + 0] + d[i * 4 + 3];
+ int s12 = d[i * 4 + 1] + d[i * 4 + 2];
+ int d03 = d[i * 4 + 0] - d[i * 4 + 3];
+ int d12 = d[i * 4 + 1] - d[i * 4 + 2];
+
+ tmp[0 * 4 + i] = s03 + s12;
+ tmp[1 * 4 + i] = 2 * d03 + d12;
+ tmp[2 * 4 + i] = s03 - s12;
+ tmp[3 * 4 + i] = d03 - 2 * d12;
+ }
+
+ for (int i = 0; i < 4; i++)
+ {
+ int s03 = tmp[i * 4 + 0] + tmp[i * 4 + 3];
+ int s12 = tmp[i * 4 + 1] + tmp[i * 4 + 2];
+ int d03 = tmp[i * 4 + 0] - tmp[i * 4 + 3];
+ int d12 = tmp[i * 4 + 1] - tmp[i * 4 + 2];
+
+ res[i * 4 + 0] = s03 + s12;
+ res[i * 4 + 1] = 2 * d03 + d12;
+ res[i * 4 + 2] = s03 - s12;
+ res[i * 4 + 3] = d03 - 2 * d12;
+ }
+}
+
+/* { dg-final { scan-tree-dump {Deleted dead store:.*tmp} "dse3" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr97456.c b/gcc/testsuite/gcc.dg/tree-ssa/pr97456.c
new file mode 100644
index 0000000..5171c9b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr97456.c
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fwhole-program" } */
+
+
+float val2 = 1.710780f;
+float val3;
+volatile float vf;
+
+int __attribute__((noipa))
+get_bool (void)
+{
+ return 1;
+}
+
+int __attribute__((noinline))
+wrong (float *pos)
+{
+ _Complex float a;
+
+ __real__ a = *pos;
+ __imag__ a = *pos;
+
+ _Complex float b = 0 + 0i;
+
+ b = b + a;
+
+ if (b == 0.0f)
+ return 1;
+
+ vf = __imag__ b;
+ return 0;
+}
+
+int main(int argc, char **argv) {
+ float val = get_bool () == 1 ? val2 : val3;
+
+ if ((wrong(&val), wrong(&val)))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr97503.c b/gcc/testsuite/gcc.dg/tree-ssa/pr97503.c
new file mode 100644
index 0000000..3a3dae6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr97503.c
@@ -0,0 +1,19 @@
+/* PR tree-optimization/97503 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-additional-options "-mbmi -mlzcnt" { target i?86-*-* x86_64-*-* } } */
+/* { dg-final { scan-tree-dump-times "\.CLZ" 2 "optimized" { target { { i?86-*-* x86_64-*-* aarch64-*-* powerpc*-*-* } && lp64 } } } } */
+/* { dg-final { scan-tree-dump-not "__builtin_clz" "optimized" { target { { i?86-*-* x86_64-*-* aarch64-*-* powerpc*-*-*} && lp64 } } } } */
+/* { dg-final { scan-tree-dump-not "PHI <" "optimized" { target { { i?86-*-* x86_64-*-* aarch64-*-* powerpc*-*-*} && lp64 } } } } */
+
+int
+foo (int x)
+{
+ return x ? __builtin_clz (x) : 32;
+}
+
+int
+bar (unsigned long long x)
+{
+ return x ? __builtin_clzll (x) : 64;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-11.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-11.c
index 36b8e7f..d70ea5a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-11.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-11.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
/* Test for CPROP across a DAG. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c
index d3a1bbc..b81cabe 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c
@@ -17,5 +17,5 @@ int foo (int *p, int b)
/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse1"} } */
/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse2"} } */
-/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse3"} } */
+/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse4"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c
index 31529e7..f4ef89c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c
@@ -22,5 +22,5 @@ foo(int cond, struct z *s)
/* { dg-final { scan-tree-dump-times "Deleted dead store" 3 "dse1"} } */
/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse2"} } */
-/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse3"} } */
+/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse4"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-7.c
new file mode 100644
index 0000000..ce9cec6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-7.c
@@ -0,0 +1,54 @@
+/* { dg-options "-O2 -fdump-tree-pre-stats" } */
+
+void baz();
+int tem;
+void foo (int a, int b, int c, int d, int e, int x, int y, int z)
+{
+ if (a)
+ {
+ if (b)
+ {
+ if (c)
+ {
+ if (d)
+ {
+ if (e)
+ {
+ tem = x + y;
+ }
+ else
+ {
+ if (z) baz ();
+ tem = x + y;
+ }
+ }
+ else
+ {
+ if (z) baz ();
+ tem = x + y;
+ }
+ }
+ else
+ {
+ if (z) baz ();
+ tem = x + y;
+ }
+ }
+ else
+ {
+ if (z) baz ();
+ tem = x + y;
+ }
+ }
+ else
+ {
+ if (z) baz ();
+ tem = x + y;
+ }
+}
+
+/* Now inserting x + y five times is unnecessary but the cascading
+ cannot be avoided with the simple-minded dataflow. But make sure
+ we do the insertions all in the first iteration. */
+/* { dg-final { scan-tree-dump "insert iterations == 2" "pre" } } */
+/* { dg-final { scan-tree-dump "HOIST inserted: 5" "pre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/switch-4.c b/gcc/testsuite/gcc.dg/tree-ssa/switch-4.c
new file mode 100644
index 0000000..5953ef3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/switch-4.c
@@ -0,0 +1,25 @@
+/* { dg-do compile { target { { x86_64-*-* aarch64-*-* ia64-*-* powerpc64-*-* } && lp64 } } } */
+/* { dg-options "-O2 -fno-bit-tests -fdump-tree-switchlower1" } */
+
+int global;
+
+int foo (int x)
+{
+ switch (x) {
+ case 0:
+ case 10:
+ return 1;
+ case 20:
+ case 30:
+ case 62:
+ return 2;
+ case 1000:
+ case 1010:
+ case 1025 ... 1030:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+/* { dg-final { scan-tree-dump-not "BT:" "switchlower1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-41.c b/gcc/testsuite/gcc.dg/vect/bb-slp-41.c
index 7de5ed1..7224511 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-41.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-41.c
@@ -10,7 +10,10 @@ foo (int *a, int *b)
a[i] = b[0] + b[1] + b[i+1] + b[i+2];
}
-void bar (int *a, int *b)
+/* Disable pre-slp FRE to avoid unexpected SLP on the epilogue
+ of the 1st loop. */
+void __attribute__((optimize("-fno-tree-fre")))
+bar (int *a, int *b)
{
int i;
for (i = 0; i < (ARR_SIZE - 2); ++i)
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-52.c b/gcc/testsuite/gcc.dg/vect/bb-slp-52.c
new file mode 100644
index 0000000..5194af8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-52.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+int a, e;
+void g(float);
+typedef struct {
+ float b, c;
+} d;
+d f;
+void h(double i, double j) {
+ if (a && e)
+ return;
+ f.b = j;
+ f.c = i;
+ g(i);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-53.c b/gcc/testsuite/gcc.dg/vect/bb-slp-53.c
new file mode 100644
index 0000000..f3b5f31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-53.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+
+double a[2], b[2];
+
+void foo(double x, double y)
+{
+ double breakme1 = y + 3.;
+ double a1 = b[1] + 2.;
+ double breakme0 = x;
+ double a0 = b[0] + 1.;
+ a[0] = a0 * breakme0;
+ a[1] = a1 * breakme1;
+}
+
+/* We should vectorize the SLP opportunity starting from the
+ grouped store to a[] including the load from b[] at the
+ leaf even though the multiplication requires another
+ vector invariant to be built. */
+/* { dg-final { scan-tree-dump "transform load" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-54.c b/gcc/testsuite/gcc.dg/vect/bb-slp-54.c
new file mode 100644
index 0000000..d05ce33
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-54.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+
+double a[2], b[2], c[2];
+
+void foo(int flag)
+{
+ double tem1, tem2;
+ if (flag)
+ {
+ tem1 = a[0];
+ tem2 = a[1];
+ }
+ else
+ {
+ tem1 = b[0];
+ tem2 = b[1];
+ }
+ c[0] = tem1;
+ c[1] = tem2;
+}
+
+/* { dg-final { scan-tree-dump-times "transform load" 2 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-55.c b/gcc/testsuite/gcc.dg/vect/bb-slp-55.c
new file mode 100644
index 0000000..57a042b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-55.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+typedef struct {
+ int a;
+ int b;
+ int c;
+ int d;
+} e;
+e *f;
+int g;
+void h() {
+ e *i;
+ if (g) {
+ i->c = f[g].b;
+ i->d = f[g].a;
+ } else
+ i->c = i->d = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-56.c b/gcc/testsuite/gcc.dg/vect/bb-slp-56.c
new file mode 100644
index 0000000..90d1751
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-56.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+typedef struct {
+ double a, b;
+} c;
+int d, e;
+int i(void);
+void h(c, c);
+void f() {
+ c a, g;
+ do {
+ a.a = e ?: g.a;
+ a.b = g.b + d;
+ h(g, a);
+ g = a;
+ } while (i());
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-57.c b/gcc/testsuite/gcc.dg/vect/bb-slp-57.c
new file mode 100644
index 0000000..6f13507
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-57.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ffast-math" } */
+/* { dg-require-effective-target vect_float } */
+
+float *a;
+typedef struct {
+ int c;
+ float bbmax[3];
+} d;
+d e;
+int f[3];
+int g, h, i, j;
+float k, k;
+void l()
+{
+ for (unsigned z = 0; z < 2048; ++z) {
+ {
+ j = e.bbmax[1] > k ? e.bbmax[1] : k;
+ }
+ e.bbmax[1] = j;
+ { i = e.bbmax[2] > k ? e.bbmax[2] : k; }
+ e.bbmax[2] = i;
+ f[2] = a[2];
+ {
+ float b;
+ h = e.bbmax[1] > b ? e.bbmax[1] : b;
+ }
+ e.bbmax[1] = h;
+ {
+ float b;
+ g = e.bbmax[2] > b ? e.bbmax[2] : b;
+ }
+ e.bbmax[2] = g;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "transform load" 1 "slp1" { target { { x86_64-*-* i?86-*-* } && lp64 } } } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp1" { target { { x86_64-*-* i?86-*-* } && lp64 } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-58.c b/gcc/testsuite/gcc.dg/vect/bb-slp-58.c
new file mode 100644
index 0000000..5a3d3b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-58.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+
+double x[1024];
+void bar (void);
+
+void foo (void)
+{
+ double tem1 = x[0];
+ double tem2 = x[1];
+ for (int i = 0; i < 511; ++i)
+ {
+ x[2*i] = tem1;
+ x[2*i+1] = tem2;
+ bar ();
+ tem1 = x[2*(i+1)];
+ tem2 = x[2*(i+1)+1];
+ }
+}
+
+/* We should be able to vectorize the cycle in one SLP attempt including
+ both load groups. */
+/* { dg-final { scan-tree-dump-times "transform load" 2 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-59.c b/gcc/testsuite/gcc.dg/vect/bb-slp-59.c
new file mode 100644
index 0000000..815b44e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-59.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+/* { dg-additional-options "-fdump-tree-loopdone" } */
+
+double x[1024];
+void bar (void);
+
+void foo (void)
+{
+ double tem1 = x[0];
+ double tem2 = x[1];
+ for (int i = 0; i < 511; ++i)
+ {
+ x[2*i] = tem2;
+ x[2*i+1] = tem1;
+ bar ();
+ tem1 = x[2*(i+1)];
+ tem2 = x[2*(i+1)+1];
+ }
+}
+
+/* We should be able to vectorize the cycle in one SLP attempt including
+ both load groups and do only one permutation. */
+/* { dg-final { scan-tree-dump-times "transform load" 2 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 1 "loopdone" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-60.c b/gcc/testsuite/gcc.dg/vect/bb-slp-60.c
new file mode 100644
index 0000000..52643bf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-60.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+enum { a = 1, b };
+float *c, *e;
+float d, h;
+int f, g;
+void i()
+{
+ float j = h;
+ for (; g;)
+ for (; f; f++)
+ {
+ c[a] = j * d;
+ c[b] = h * d;
+ j = 0;
+ h = e[2];
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-61.c b/gcc/testsuite/gcc.dg/vect/bb-slp-61.c
new file mode 100644
index 0000000..3323a2b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-61.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+struct a {
+ enum { b, c } d;
+ unsigned e;
+ unsigned f;
+};
+void j(struct a *a, int i, int h)
+{
+ unsigned f = a->f;
+ switch (a->d)
+ while (1)
+ {
+ if (i)
+ {
+ case b:
+ if (h)
+ goto k;
+ }
+ else
+ f = 0;
+ case c:;
+ }
+k:
+ a->e = a->f = f;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-62.c b/gcc/testsuite/gcc.dg/vect/bb-slp-62.c
new file mode 100644
index 0000000..84ee04c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-62.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+typedef struct {
+ char a;
+ int b[];
+} c;
+int d, f;
+c e;
+void g() {
+ int h, i, j;
+ for (; i;)
+ switch (i)
+ case 4: {
+ h = (__UINTPTR_TYPE__)g >= 3;
+ for (; h; h -= 1)
+ if (d)
+ j = f;
+ }
+ for (; i < 3; i++)
+ e.b[i] = j;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-63.c b/gcc/testsuite/gcc.dg/vect/bb-slp-63.c
new file mode 100644
index 0000000..6519c97
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-63.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+struct {
+ unsigned a;
+ unsigned c;
+} d;
+int e, g;
+void h(unsigned b) {
+ unsigned a, c;
+ while (e) {
+ if (b) {
+ ++e;
+ continue;
+ }
+ c = g;
+ if (g)
+ a |= 10;
+ }
+ d.a = a;
+ d.c = c;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-64.c b/gcc/testsuite/gcc.dg/vect/bb-slp-64.c
new file mode 100644
index 0000000..dcb6a14
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-64.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+enum { a, b };
+double *c, *e;
+int d, f;
+void g() {
+ for (;;) {
+ c[a] = c[b] = d * e[b];
+ f = d -= f;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-65.c b/gcc/testsuite/gcc.dg/vect/bb-slp-65.c
new file mode 100644
index 0000000..ec1707b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-65.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+/* { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } */
+
+int *a;
+int b, c, d, e;
+void f() {
+ int g;
+ for (;;)
+ for (; b;)
+ if (d)
+ for (; c;)
+ if (g)
+ e += a[1] = a[2] = e;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-66.c b/gcc/testsuite/gcc.dg/vect/bb-slp-66.c
new file mode 100644
index 0000000..b59a2cc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-66.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+typedef struct {
+ double a, b;
+} c;
+typedef struct {
+ c d;
+ long coordinates;
+} e;
+int f;
+c g;
+e h;
+void k(int);
+int n();
+void j() { int i; k(i); }
+void k(int l) {
+ double a;
+ int b;
+ c m[4];
+ long i;
+ for (; l;)
+ do {
+ g.a = b ?: a;
+ m[3] = g;
+ if (f)
+ m[0] = m[1] = m[3];
+ i = 0;
+ for (; i < 4; i++)
+ (&h + i)->d = m[i];
+ } while (n());
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-67.c b/gcc/testsuite/gcc.dg/vect/bb-slp-67.c
new file mode 100644
index 0000000..ff959c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-67.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_float } */
+
+float a[6];
+
+void foo (float x, float y)
+{
+ a[0] = 1.;
+ a[1] = 2.;
+ a[2] = 3.;
+ a[3] = 4.;
+ a[4] = 5.;
+ a[5] = x + y;
+}
+
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-68.c b/gcc/testsuite/gcc.dg/vect/bb-slp-68.c
new file mode 100644
index 0000000..8718031
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-68.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+/* { dg-additional-options "-mavx" { target avx } } */
+
+double x[10], y[6], z[4];
+
+void foo ()
+{
+ x[0] = y[0];
+ x[1] = y[1];
+ x[2] = y[2];
+ x[3] = y[3];
+ x[4] = y[4];
+ x[5] = y[5];
+ x[6] = z[0] + 1.;
+ x[7] = z[1] + 1.;
+ x[8] = z[2] + 1.;
+ x[9] = z[3] + 1.;
+}
+
+/* We want to have the store group split into 4, 2, 4 when using 32byte vectors. */
+/* { dg-final { scan-tree-dump-not "from scalars" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-69.c b/gcc/testsuite/gcc.dg/vect/bb-slp-69.c
new file mode 100644
index 0000000..ca72a68
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-69.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+_Bool arr[16];
+
+void foo(char *q)
+{
+ char *p = __builtin_assume_aligned (q, 16);
+ _Bool b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15;
+ b0 = p[0] != 0;
+ b1 = p[1] != 0;
+ b2 = p[2] != 0;
+ b3 = p[3] != 0;
+ b4 = p[4] != 0;
+ b5 = p[5] != 0;
+ b6 = p[6] != 0;
+ b7 = p[7] != 0;
+ b8 = p[8] != 0;
+ b9 = p[9] != 0;
+ b10 = p[10] != 0;
+ b11 = p[11] != 0;
+ b12 = p[12] != 0;
+ b13 = p[13] != 0;
+ b14 = p[14] != 0;
+ b15 = p[15] != 0;
+ arr[0] = b0;
+ arr[1] = b1;
+ arr[2] = b2;
+ arr[3] = b3;
+ arr[4] = b4;
+ arr[5] = b5;
+ arr[6] = b6;
+ arr[7] = b7;
+ arr[8] = b8;
+ arr[9] = b9;
+ arr[10] = b10;
+ arr[11] = b11;
+ arr[12] = b12;
+ arr[13] = b13;
+ arr[14] = b14;
+ arr[15] = b15;
+}
+
+/* { dg-final { scan-tree-dump "transform load" "slp2" } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c
index f6b99ea..c50560b 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c
@@ -13,13 +13,13 @@ foo (short * __restrict__ a, int * __restrict__ b, int stride)
for (i = 0; i < N/stride; i++, a += stride, b += stride)
{
a[0] = b[0] ? 1 : 7;
- a[1] = b[1] ? 2 : 0;
+ a[1] = b[1] ? 2 : 7;
a[2] = b[2] ? 3 : 0;
- a[3] = b[3] ? 4 : 0;
+ a[3] = b[3] ? 4 : 7;
a[4] = b[4] ? 5 : 0;
a[5] = b[5] ? 6 : 0;
a[6] = b[6] ? 7 : 0;
- a[7] = b[7] ? 8 : 0;
+ a[7] = b[7] ? 8 : 7;
}
}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c
index ea37e4e..5d80f56 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c
@@ -60,6 +60,7 @@ int main()
/* We should also be able to use 2-lane SLP to initialize the real and
imaginary components in the first loop of main. */
/* { dg-final { scan-tree-dump-times "optimized: basic block" 10 "slp1" } } */
-/* We should see the s->phase[dir] operand and only that operand built
+/* We should see the s->phase[dir] operand splatted and no other operand built
from scalars. See PR97334. */
-/* { dg-final { scan-tree-dump-times "Building vector operands from scalars" 1 "slp1" } } */
+/* { dg-final { scan-tree-dump "Using a splat" "slp1" } } */
+/* { dg-final { scan-tree-dump-times "Building vector operands from scalars" 0 "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c
new file mode 100644
index 0000000..17d48a7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+struct {
+ int *end_info;
+ int *fp;
+} png_load_body_c;
+
+int *png_set_longjmp_fn();
+
+void setjmp();
+
+void png_load_body()
+{
+ int *fp;
+ int png_ptr, info_ptr, *end_info;
+ if (!fp)
+ return;
+ if (png_ptr) {
+ info_ptr = 0;
+ end_info = png_set_longjmp_fn();
+ }
+ png_load_body_c.end_info = end_info;
+ png_load_body_c.fp = fp;
+ if (png_ptr)
+ png_set_longjmp_fn();
+ setjmp(info_ptr);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97496.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97496.c
new file mode 100644
index 0000000..fa9e980
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97496.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+int a;
+int b[1024];
+void c(unsigned g) {
+ if (a) {
+ long e = g, d = e;
+ int f = 0;
+ for (; f < 4; f++) {
+ b[f] = d;
+ d >>= 8;
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97615.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97615.c
new file mode 100644
index 0000000..b4a8aa2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97615.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+short *a;
+int e, f;
+
+void
+foo (int c, int d)
+{
+ short *a1, *a2, *a3;
+ a1 = a++;
+ *a1 = c;
+ a2 = a++;
+ *a2 = *a1;
+ a3 = a++;
+ *a3 = d;
+}
+
+void
+bar (void)
+{
+ foo (e + f - 2, e + f - 1);
+ foo (e + f - 1, 0);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97626.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97626.c
new file mode 100644
index 0000000..943d8a6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97626.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+
+struct {
+ int x;
+ int y;
+} do_plasma_rect;
+
+int do_plasma_context_0, do_plasma_x2, do_plasma_y2, do_plasma_plasma_depth,
+ do_plasma_xm, do_plasma_ym;
+void gegl_buffer_set();
+
+void do_plasma(int x1, int y1) {
+ if (__builtin_expect(({
+ int _g_boolean_var_;
+ if (do_plasma_context_0)
+ _g_boolean_var_ = 1;
+ else
+ _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }),
+ 0)) {
+ do_plasma_rect.x = x1;
+ do_plasma_rect.y = y1;
+ gegl_buffer_set();
+ }
+ do_plasma_xm = (x1 + do_plasma_x2) / 2;
+ do_plasma_ym = (y1 + do_plasma_y2) / 2;
+ if (do_plasma_plasma_depth) {
+ do_plasma_rect.x = do_plasma_xm;
+ do_plasma_rect.y = do_plasma_ym;
+ return;
+ }
+ do_plasma(do_plasma_xm, do_plasma_ym);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97633.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97633.c
new file mode 100644
index 0000000..ab0ae1d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97633.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+extern short i (void);
+
+struct {
+ short a;
+ short b;
+} c;
+
+int d, e;
+static int f = 1;
+
+void g () {
+ if (e) {
+ if (f)
+ goto L;
+ while (d) {
+ i ();
+ short j = d, k = i (), l = k;
+ L:
+ if (!(d && e) || l)
+ goto L;
+ c.a = j;
+ c.b = k;
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97650.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97650.c
new file mode 100644
index 0000000..f9c91fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97650.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Os -fallow-store-data-races" } */
+
+short a=0;
+unsigned long *volatile *volatile *volatile *b;
+unsigned long *volatile *volatile *volatile **c[7];
+void d() {
+ short e=0;
+ for (; a;) {
+ e = 0;
+ for (; e < 7; e++)
+ c[e] = &b;
+ }
+}
+int main() { return 0; }
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97706.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97706.c
new file mode 100644
index 0000000..228ae70
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97706.c
@@ -0,0 +1,61 @@
+/* { dg-do compile } */
+
+_Bool arr[16];
+void bar();
+void foo(int n, char *p)
+{
+ _Bool b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15;
+ do
+ {
+ b0 = p[0] != 0;
+ b1 = p[1] != 0;
+ b2 = p[2] != 0;
+ b3 = p[3] != 0;
+ b4 = p[4] != 0;
+ b5 = p[5] != 0;
+ b6 = p[6] != 0;
+ b7 = p[7] != 0;
+ b8 = p[8] != 0;
+ b9 = p[9] != 0;
+ b10 = p[10] != 0;
+ b11 = p[11] != 0;
+ b12 = p[12] != 0;
+ b13 = p[13] != 0;
+ b14 = p[14] != 0;
+ b15 = p[15] != 0;
+ arr[0] = b0;
+ arr[1] = b1;
+ arr[2] = b2;
+ arr[3] = b3;
+ arr[4] = b4;
+ arr[5] = b5;
+ arr[6] = b6;
+ arr[7] = b7;
+ arr[8] = b8;
+ arr[9] = b9;
+ arr[10] = b10;
+ arr[11] = b11;
+ arr[12] = b12;
+ arr[13] = b13;
+ arr[14] = b14;
+ arr[15] = b15;
+ bar ();
+ }
+ while (--n);
+ arr[0] = b0;
+ arr[1] = b1;
+ arr[2] = b2;
+ arr[3] = b3;
+ arr[4] = b4;
+ arr[5] = b5;
+ arr[6] = b6;
+ arr[7] = b7;
+ arr[8] = b8;
+ arr[9] = b9;
+ arr[10] = b10;
+ arr[11] = b11;
+ arr[12] = b12;
+ arr[13] = b13;
+ arr[14] = b14;
+ arr[15] = b15;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97709.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97709.c
new file mode 100644
index 0000000..672807f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97709.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+int a;
+struct b {
+ int c;
+ int d;
+};
+void k (struct b);
+struct b
+e()
+{
+ void *f[] = {&&g, &&h, &&i, &&j};
+ int d, c;
+j:
+ goto *a;
+g:
+ d = 0;
+h:
+ c = 1;
+ goto *a;
+i:
+ {
+ struct b b = {c, d};
+ k(b);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97732.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97732.c
new file mode 100644
index 0000000..5187090
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97732.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+struct S { int a, b; } *e;
+int d;
+
+void
+foo (struct S *x)
+{
+ for (e = x; d; d++, e++)
+ e->a = e->b = (int) (__UINTPTR_TYPE__) e;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97746.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97746.c
new file mode 100644
index 0000000..c5a615d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97746.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+int a, b;
+short c;
+
+extern void f (short*);
+
+void d()
+{
+ short e[2] = {0, 0};
+ while (a)
+ {
+ f(e);
+ int g = 0 || a, h = 8 && c;
+ short i = c;
+ c = h & g;
+ if (b)
+ b = g || i;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c
index dcb5370..8cc69ab 100644
--- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c
+++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c
@@ -75,5 +75,3 @@ int main ()
/* The initialization induction loop (with aligned access) is also vectorized. */
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */
-/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 1 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr97428.c b/gcc/testsuite/gcc.dg/vect/pr97428.c
new file mode 100644
index 0000000..49d5373
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97428.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+
+typedef struct { double re, im; } dcmlx_t;
+typedef struct { double re[4], im[4]; } dcmlx4_t;
+
+void foo_i2(dcmlx4_t dst[], const dcmlx_t src[], int n)
+{
+ for (int i = 0; i < n; ++i) {
+ dcmlx_t s00 = src[i*4+0];
+ dcmlx_t s01 = src[i*4+1];
+ dcmlx_t s02 = src[i*4+2];
+ dcmlx_t s03 = src[i*4+3];
+
+ dcmlx_t s10 = src[i*4+0+n];
+ dcmlx_t s11 = src[i*4+1+n];
+ dcmlx_t s12 = src[i*4+2+n];
+ dcmlx_t s13 = src[i*4+3+n];
+
+ dst[i*2+0].re[0] = s00.re;
+ dst[i*2+0].re[1] = s01.re;
+ dst[i*2+0].re[2] = s02.re;
+ dst[i*2+0].re[3] = s03.re;
+ dst[i*2+0].im[0] = s00.im;
+ dst[i*2+0].im[1] = s01.im;
+ dst[i*2+0].im[2] = s02.im;
+ dst[i*2+0].im[3] = s03.im;
+
+ dst[i*2+1].re[0] = s10.re;
+ dst[i*2+1].re[1] = s11.re;
+ dst[i*2+1].re[2] = s12.re;
+ dst[i*2+1].re[3] = s13.re;
+ dst[i*2+1].im[0] = s10.im;
+ dst[i*2+1].im[1] = s11.im;
+ dst[i*2+1].im[2] = s12.im;
+ dst[i*2+1].im[3] = s13.im;
+ }
+}
+
+/* The first step to produce optimal code is to appropriately detect the
+ load and store groups. */
+/* { dg-final { scan-tree-dump "Detected interleaving load of size 8" "vect" } } */
+/* { dg-final { scan-tree-dump "Detected interleaving store of size 16" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-not "gap of 6 elements" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr97457.c b/gcc/testsuite/gcc.dg/vect/pr97457.c
new file mode 100644
index 0000000..506ba24
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97457.c
@@ -0,0 +1,15 @@
+/* { dg-additional-options "-O3" } */
+
+int a;
+long c;
+signed char d(char e, char f) { return e + f; }
+int main(void) {
+ for (; a <= 1; a++) {
+ c = -8;
+ for (; c != 3; c = d(c, 1))
+ ;
+ }
+ char b = c;
+ if (b != 3)
+ __builtin_abort();
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97558-2.c b/gcc/testsuite/gcc.dg/vect/pr97558-2.c
new file mode 100644
index 0000000..8f08086
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97558-2.c
@@ -0,0 +1,54 @@
+/* { dg-do run } */
+/* { dg-additional-options "-O3 -fno-tree-forwprop -fno-tree-scev-cprop" } */
+
+#include "tree-vect.h"
+
+#define N 40
+
+int a[N];
+int b[N];
+
+__attribute__ ((noinline)) int
+foo (int n){
+ int i,j;
+ int sum,x,y;
+
+ if (n<=0)
+ return 0;
+
+ for (i = 0; i < N/2; i++) {
+ sum = 0;
+ x = b[2*i];
+ y = b[2*i+1];
+ for (j = 0; j < n; j++) {
+ sum += j;
+ }
+ a[2*i] = sum + x;
+ a[2*i+1] = sum + y;
+ }
+}
+
+int main (void)
+{
+ int i,j;
+ int sum;
+
+ check_vect ();
+
+ for (i=0; i<N; i++)
+ b[i] = i;
+
+ foo (N-1);
+
+ /* check results: */
+ for (i=0; i<N/2; i++)
+ {
+ sum = 0;
+ for (j = 0; j < N-1; j++)
+ sum += j;
+ if (a[2*i] != sum + b[2*i] || a[2*i+1] != sum + b[2*i+1])
+ abort();
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97558.c b/gcc/testsuite/gcc.dg/vect/pr97558.c
new file mode 100644
index 0000000..fef9623
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97558.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-dce -Ofast" } */
+
+long int x1;
+int fr;
+
+int
+us (int sk, int jx)
+{
+ while (sk < 1)
+ {
+ jx *= 2;
+ fr += x1 + 1;
+ ++sk;
+ }
+
+ return jx;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97678.c b/gcc/testsuite/gcc.dg/vect/pr97678.c
new file mode 100644
index 0000000..ebe4a35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97678.c
@@ -0,0 +1,29 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-mavx2" { target avx2_runtime } } */
+
+#include "tree-vect.h"
+
+int
+main ()
+{
+ unsigned int i = 0;
+ unsigned short b[158 * 2];
+
+ check_vect ();
+
+ for (i = 0; i < 158; i++)
+ {
+ b[i * 2] = i * 7;
+ b[i * 2 + 1] = i * 8;
+ }
+
+ for (i = 0; i < 158; ++i)
+ if (b[i*2] != (unsigned short)(i*7)
+ || b[i*2+1] != (unsigned short)(i*8))
+ abort ();
+
+ return 0;
+}
+
+/* The init loop should be vectorized with SLP. */
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr97753.c b/gcc/testsuite/gcc.dg/vect/pr97753.c
new file mode 100644
index 0000000..e49a848
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97753.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+long a[6];
+void d(int c)
+{
+ for (; c; c++)
+ for (int b = 0; b < 8; b++)
+ ((char *)&a[c])[b] = c;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97760.c b/gcc/testsuite/gcc.dg/vect/pr97760.c
new file mode 100644
index 0000000..da5ac93
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97760.c
@@ -0,0 +1,26 @@
+#include "tree-vect.h"
+
+int b=1;
+static int *g = &b;
+
+void __attribute__((noipa))
+h (unsigned int n)
+{
+ int i = 3;
+ int f = 3;
+ for (; f <= 50; f += 4) {
+ i += 4;
+ *g = i;
+ i += n;
+ }
+}
+
+int main ()
+{
+ check_vect ();
+
+ h (9);
+ if (*g != 150 || b != 150)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97769.c b/gcc/testsuite/gcc.dg/vect/pr97769.c
new file mode 100644
index 0000000..127f91a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97769.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+typedef struct {
+ int alg;
+ int h1[8];
+ unsigned d1[1];
+} tmp;
+typedef struct {
+ tmp itmp;
+ tmp otmp;
+} h1;
+h1 c;
+
+static void
+fn1(char *p1, int p2)
+{
+ int i = 0;
+ for (; i < 4; i++)
+ *p1++ = p2;
+}
+
+static void
+fn2(tmp *p1)
+{
+ char *d = (char *)p1->d1;
+ int *b = p1->h1;
+ for (int a; a; a++, d += 4)
+ fn1(d, *b++);
+}
+
+void fn3() { fn2(&(&c)->otmp); }
diff --git a/gcc/testsuite/gcc.dg/vect/slp-11b.c b/gcc/testsuite/gcc.dg/vect/slp-11b.c
index 0cc2377..0aece80 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-11b.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-11b.c
@@ -45,4 +45,5 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_strided4 && vect_int_mult } } } } */
/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { target { ! { vect_strided4 && vect_int_mult } } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { ! vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_load_lanes } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-49.c b/gcc/testsuite/gcc.dg/vect/slp-49.c
new file mode 100644
index 0000000..3f53baf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-49.c
@@ -0,0 +1,38 @@
+/* { dg-require-effective-target vect_int } */
+
+#include "tree-vect.h"
+
+int a[1024];
+
+void __attribute__((noipa))
+foo(int k)
+{
+ int j = 5;
+ for (int i = 0; i < 512; ++i)
+ {
+ a[2*i] = j;
+ a[2*i+1] = k;
+ j++;
+ k+=3;
+ }
+}
+
+int
+main()
+{
+ check_vect ();
+
+ foo (17);
+
+ for (int i = 0; i < 512; ++i)
+ {
+ if (a[2*i] != 5 + i
+ || a[2*i+1] != 17 + 3 * i)
+ __builtin_abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
+/* { dg-final { scan-tree-dump "Loop contains only SLP stmts" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-6.c b/gcc/testsuite/gcc.dg/vect/slp-perm-6.c
index 3848929..cc863de 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-perm-6.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-perm-6.c
@@ -106,7 +106,7 @@ int main (int argc, const char* argv[])
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && {! vect_partial_vectors_usage_1 } } } } } } */
/* The epilogues are vectorized using partial vectors. */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && vect_partial_vectors_usage_1 } } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_load_lanes } } } */
-/* { dg-final { scan-tree-dump "Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } } } } */
-/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
-/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } xfail { vect_perm3_int && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target { vect_load_lanes } xfail { vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target { vect_load_lanes } xfail { vect_load_lanes } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/tree-vect.h b/gcc/testsuite/gcc.dg/vect/tree-vect.h
index 5d8d9eb..c4b8144 100644
--- a/gcc/testsuite/gcc.dg/vect/tree-vect.h
+++ b/gcc/testsuite/gcc.dg/vect/tree-vect.h
@@ -52,7 +52,7 @@ check_vect (void)
want_level = 1, want_d = bit_SSE2;
# endif
- if (!__get_cpuid (want_level, &a, &b, &c, &d)
+ if (!__get_cpuid_count (want_level, 0, &a, &b, &c, &d)
|| ((b & want_b) | (c & want_c) | (d & want_d)) == 0)
exit (0);
}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-103.c b/gcc/testsuite/gcc.dg/vect/vect-103.c
index 2a45104..d03562f 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-103.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-103.c
@@ -58,5 +58,3 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "accesses have the same alignment" 1 "vect" } } */
-
diff --git a/gcc/testsuite/gcc.dg/vect/vect-91.c b/gcc/testsuite/gcc.dg/vect/vect-91.c
index 91264d9..8983c7da 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-91.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-91.c
@@ -68,6 +68,4 @@ main3 ()
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { xfail vect_no_int_add } } } */
-/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 3 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */
-/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" {target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
index a2e3590..0648637 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
@@ -40,4 +40,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-slp-1.c b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-1.c
new file mode 100644
index 0000000..62b18bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-1.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+int a[1024];
+
+void foo (void)
+{
+ for (int i = 0; i < 1020; i += 4)
+ {
+ int suma = a[i];
+ int sumb = a[i+1];
+ int sumc = a[i+2];
+ int sumd = a[i+3];
+ for (unsigned j = 0; j < 77; ++j)
+ {
+ suma = (suma ^ i) + 1;
+ sumb = (sumb ^ i) + 2;
+ sumc = (sumc ^ i) + 3;
+ sumd = (sumd ^ i) + 4;
+ }
+ a[i] = suma;
+ a[i+1] = sumb;
+ a[i+2] = sumc;
+ a[i+3] = sumd;
+ }
+}
+
+/* We should vectorize this outer loop with SLP. */
+/* { dg-final { scan-tree-dump "OUTER LOOP VECTORIZED" "vect" } } */
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-slp-2.c b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-2.c
new file mode 100644
index 0000000..08b4fc5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-2.c
@@ -0,0 +1,51 @@
+/* { dg-require-effective-target vect_double } */
+/* { dg-require-effective-target vect_intdouble_cvt } */
+
+#include "tree-vect.h"
+
+double image[40];
+
+void __attribute__((noipa))
+foo (void)
+{
+ for (int i = 0; i < 20; i++)
+ {
+ double suma = 0;
+ double sumb = 0;
+ for (int j = 0; j < 40; j++)
+ {
+ suma += j+i;
+ sumb += j+i;
+ }
+ image[2*i] = suma;
+ image[2*i+1] = sumb;
+ }
+}
+
+int main ()
+{
+ check_vect ();
+
+ foo ();
+
+ for (int i = 0; i < 20; i++)
+ {
+ double suma = 0;
+ double sumb = 0;
+ for (int j = 0; j < 40; j++)
+ {
+ suma += j+i;
+ sumb += j+i;
+ asm ("" : "+g" (suma));
+ asm ("" : "+g" (sumb));
+ }
+ if (image[2*i] != suma
+ || image[2*i+1] != sumb)
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-slp-3.c b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-3.c
new file mode 100644
index 0000000..c67d369
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-3.c
@@ -0,0 +1,62 @@
+/* { dg-require-effective-target vect_double } */
+/* { dg-require-effective-target vect_intdouble_cvt } */
+
+#include "tree-vect.h"
+
+double image[40];
+
+void __attribute__((noipa))
+foo (void)
+{
+ for (int i = 0; i < 20; i++)
+ {
+ double suma = 0;
+ double sumb = 0;
+ int k = image[2*i];
+ int l = image[2*i+1];
+ for (int j = 0; j < 40; j++)
+ {
+ suma += k+i;
+ sumb += l+i;
+ k++;
+ l++;
+ }
+ image[2*i] = suma;
+ image[2*i+1] = sumb;
+ }
+}
+
+int main ()
+{
+ check_vect ();
+
+ for (int i = 0; i < 40; ++i)
+ image[i] = 1.;
+
+ foo ();
+
+ for (int i = 0; i < 20; i++)
+ {
+ double suma = 0;
+ double sumb = 0;
+ int k = 1;
+ int l = 1;
+ for (int j = 0; j < 40; j++)
+ {
+ suma += k+i;
+ sumb += l+i;
+ asm ("" : "+g" (suma));
+ asm ("" : "+g" (sumb));
+ k++;
+ l++;
+ }
+ if (image[2*i] != suma
+ || image[2*i+1] != sumb)
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */