aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-10-27 08:47:25 -0700
committerIan Lance Taylor <iant@golang.org>2021-10-27 08:47:25 -0700
commita6d3012b274f38b20e2a57162106f625746af6c6 (patch)
tree09ff8b13eb8ff7594c27dc8812efbf696dc97484 /gcc/testsuite/gcc.dg
parentcd2fd5facb5e1882d3f338ed456ae9536f7c0593 (diff)
parent99b1021d21e5812ed01221d8fca8e8a32488a934 (diff)
downloadgcc-a6d3012b274f38b20e2a57162106f625746af6c6.zip
gcc-a6d3012b274f38b20e2a57162106f625746af6c6.tar.gz
gcc-a6d3012b274f38b20e2a57162106f625746af6c6.tar.bz2
Merge from trunk revision 99b1021d21e5812ed01221d8fca8e8a32488a934.
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c364
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-48.c4
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c21
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-51.c5
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-87.c2
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-90.c147
-rw-r--r--gcc/testsuite/gcc.dg/Warray-parameter-3-novec.c16
-rw-r--r--gcc/testsuite/gcc.dg/Warray-parameter-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/Wrestrict-23.c146
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-14-novec.c16
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-14.c7
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-21-novec.c34
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-21.c8
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-22.c11
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-68.c17
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c88
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-76.c18
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-77.c516
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-78.c518
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-79.c70
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-80.c70
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-81.c38
-rw-r--r--gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2-novec.c45
-rw-r--r--gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr94851-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/format/c11-dfp-printf-1.c35
-rw-r--r--gcc/testsuite/gcc.dg/format/c11-dfp-scanf-1.c35
-rw-r--r--gcc/testsuite/gcc.dg/format/c11-printf-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/format/c11-scanf-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/format/c2x-dfp-printf-1.c35
-rw-r--r--gcc/testsuite/gcc.dg/format/c2x-dfp-scanf-1.c35
-rw-r--r--gcc/testsuite/gcc.dg/format/c2x-printf-1.c26
-rw-r--r--gcc/testsuite/gcc.dg/format/c2x-scanf-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/format/ext-10.c13
-rw-r--r--gcc/testsuite/gcc.dg/format/ext-9.c29
-rw-r--r--gcc/testsuite/gcc.dg/gimplefe-error-12.c10
-rw-r--r--gcc/testsuite/gcc.dg/gomp/sections-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/gomp/simd-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/simd-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr69728.c4
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-dsyr2k-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-dsyr2k.c3
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-dsyrk-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-dsyrk.c3
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr102714.c117
-rw-r--r--gcc/testsuite/gcc.dg/loop-8.c19
-rw-r--r--gcc/testsuite/gcc.dg/optimize-bswapsi-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/optimize-bswapsi-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/plugin/gil-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr102385.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr102585.c6
-rw-r--r--gcc/testsuite/gcc.dg/pr102738.c49
-rw-r--r--gcc/testsuite/gcc.dg/pr102764.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr102798.c41
-rw-r--r--gcc/testsuite/gcc.dg/pr102827.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr102897.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr36902.c5
-rw-r--r--gcc/testsuite/gcc.dg/shrink-wrap-loop.c54
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr102762.c11
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr102920.c25
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr69760.c3
-rw-r--r--gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-23.c24
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ifc-20040816-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-rawmemchr-1.c72
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-rawmemchr-2.c83
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-1.c100
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-2.c58
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-3.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr102736.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr20701.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr20702.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21086.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21090.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr21559.c7
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr25382.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr58480.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr59597.c10
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr71437.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-9.c10
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-18.c27
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2a.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-4.c62
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c44
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c8
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-97.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c50
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c73
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-backedge.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-invalid.c102
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp08.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp55.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp98-1.c41
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp98.c2
-rw-r--r--gcc/testsuite/gcc.dg/ubsan/pr81981.c2
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr89230-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-16.c5
101 files changed, 3332 insertions, 443 deletions
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c b/gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c
new file mode 100644
index 0000000..da179a2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c
@@ -0,0 +1,364 @@
+/* PR middle-end/91647 - missing -Warray-bounds accessing a zero-length array
+ of a declared object
+ { dg-do "compile" }
+ { dg-options "-O2 -Wall -fno-tree-vectorize" }
+ { dg-require-effective-target alloca } */
+
+typedef __INT16_TYPE__ int16_t;
+typedef __INT32_TYPE__ int32_t;
+
+void sink (void*);
+
+/* Exercise a true flexible member. */
+
+struct AX
+{
+ int32_t n;
+ int16_t ax[]; // { dg-message "while referencing 'ax'" "member" }
+};
+
+static void warn_ax_local (struct AX *p)
+{
+ p->ax[0] = 0; // { dg-warning "\\\[-Warray-bounds" }
+ p->ax[1] = 1; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void nowarn_ax_extern (struct AX *p)
+{
+ p->ax[0] = 0; p->ax[99] = 99; p->ax[999] = 999; p->ax[9999] = 9999;
+}
+
+static void warn_ax_local_buf (struct AX *p)
+{
+ p->ax[0] = 4; p->ax[1] = 5;
+
+ p->ax[2] = 6; // { dg-warning "\\\[-Warray-bounds" }
+ p->ax[3] = 7; // { dg-warning "\\\[-Warray-bounds" }
+ p->ax[4] = 8; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void warn_ax_extern_buf (struct AX *p)
+{
+ p->ax[0] = 9; p->ax[1] = 10; p->ax[2] = 11;
+
+ p->ax[3] = 12; // { dg-warning "\\\[-Warray-bounds" }
+ p->ax[4] = 13; // { dg-warning "\\\[-Warray-bounds" }
+ p->ax[5] = 14; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void nowarn_ax_extern_bufx (struct AX *p)
+{
+ p->ax[0] = 0; p->ax[99] = 99; p->ax[999] = 999; p->ax[9999] = 9999;
+}
+
+static void nowarn_ax_ref (struct AX *p)
+{
+ p->ax[0] = 0; p->ax[99] = 99; p->ax[999] = 999; p->ax[9999] = 9999;
+}
+
+void test_ax (struct AX *p, unsigned n)
+{
+ {
+ struct AX sax; // { dg-message "defined here" "struct definition" }
+ warn_ax_local (&sax);
+ sink (&sax);
+ }
+
+ {
+ extern
+ struct AX xsax;
+ nowarn_ax_extern (&xsax);
+ sink (&xsax);
+ }
+
+ {
+ /* Verify out-of-bounds access to the local BUF is diagnosed. */
+ char ax_buf_p2[sizeof (struct AX) + 2 * sizeof (int16_t)];
+ warn_ax_local_buf ((struct AX*) ax_buf_p2);
+ sink (ax_buf_p2);
+ }
+
+ {
+ /* Verify out-of-bounds access to the extern BUF with a known
+ bound is diagnosed. */
+ extern char ax_buf_p3[sizeof (struct AX) + 3 * sizeof (int16_t)];
+ warn_ax_extern_buf ((struct AX*) ax_buf_p3);
+ sink (ax_buf_p3);
+ }
+
+ {
+ /* Verify that accesses to BUFX with an unknown bound are not
+ diagnosed. */
+ extern char bufx[];
+ nowarn_ax_extern_bufx ((struct AX*) bufx);
+ sink (bufx);
+ }
+
+ {
+ /* Verify that accesses to BUFN with a runtime bound are not
+ diagnosed. */
+ char bufn[n];
+ nowarn_ax_extern_bufx ((struct AX*) bufn);
+ sink (bufn);
+ }
+
+ nowarn_ax_ref (p);
+}
+
+
+/* Exercise a zero-length trailing member array. It's the same as above
+ except that extern declarations with no definitions are considered to
+ have zero elements (they can't be initialized to have any). */
+
+struct A0
+{
+ int32_t n;
+ int16_t a0[0]; // { dg-message "while referencing 'a0'" "member" }
+};
+
+static void warn_a0_local (struct A0 *p)
+{
+ p->a0[0] = 0; // { dg-warning "\\\[-Warray-bounds" }
+ p->a0[1] = 1; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void warn_a0_extern (struct A0 *p)
+{
+ p->a0[0] = 2; // { dg-warning "\\\[-Warray-bounds" }
+ p->a0[1] = 3; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void warn_a0_local_buf (struct A0 *p)
+{
+ p->a0[0] = 4; p->a0[1] = 5;
+
+ p->a0[2] = 6; // { dg-warning "\\\[-Warray-bounds" }
+ p->a0[3] = 7; // { dg-warning "\\\[-Warray-bounds" }
+ p->a0[4] = 8; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void warn_a0_extern_buf (struct A0 *p)
+{
+ p->a0[0] = 9; p->a0[1] = 10; p->a0[2] = 11;
+
+ p->a0[3] = 12; // { dg-warning "\\\[-Warray-bounds" }
+ p->a0[4] = 13; // { dg-warning "\\\[-Warray-bounds" }
+ p->a0[5] = 14; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void nowarn_a0_extern_bufx (struct A0 *p)
+{
+ p->a0[0] = 0; p->a0[99] = 99; p->a0[999] = 999; p->a0[9999] = 9999;
+}
+
+static void nowarn_a0_ref (struct A0 *p)
+{
+ p->a0[0] = 0; p->a0[99] = 99; p->a0[999] = 999; p->a0[9999] = 9999;
+}
+
+void test_a0 (struct A0 *p, unsigned n)
+{
+ {
+ struct A0 sa0; // { dg-message "defined here" "struct definition" }
+ warn_a0_local (&sa0);
+ sink (&sa0);
+ }
+
+ {
+ extern
+ struct A0 xsa0; // { dg-message "defined here" "struct definition" }
+ warn_a0_extern (&xsa0);
+ sink (&xsa0);
+ }
+
+ {
+ /* Verify out-of-bounds access to the local BUF is diagnosed. */
+ char a0_buf_p2[sizeof (struct A0) + 2 * sizeof (int16_t)];
+ warn_a0_local_buf ((struct A0*) a0_buf_p2);
+ sink (a0_buf_p2);
+ }
+
+ {
+ /* Verify out-of-bounds access to the extern BUF with a known
+ bound is diagnosed. */
+ extern char a0_buf_p3[sizeof (struct A0) + 3 * sizeof (int16_t)];
+ warn_a0_extern_buf ((struct A0*) a0_buf_p3);
+ sink (a0_buf_p3);
+ }
+
+ {
+ /* Verify that accesses to BUFX with an unknown bound are not
+ diagnosed. */
+ extern char bufx[];
+ nowarn_a0_extern_bufx ((struct A0*) bufx);
+ sink (bufx);
+ }
+
+ {
+ /* Verify that accesses to BUFN with a runtime bound are not
+ diagnosed. */
+ char bufn[n];
+ nowarn_a0_extern_bufx ((struct A0*) bufn);
+ sink (bufn);
+ }
+
+ nowarn_a0_ref (p);
+}
+
+
+/* Exercise a one-element trailing member array. It's the same as above
+ except that it has exactly one element. */
+
+struct A1
+{
+ int32_t n;
+ int16_t a1[1]; // { dg-message "while referencing 'a1'" }
+};
+
+static void warn_a1_local_noinit (struct A1 *p)
+{
+ p->a1[0] = 0;
+ p->a1[1] = 1; // { dg-warning "\\\[-Warray-bounds" }
+ p->a1[2] = 2; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void warn_a1_extern (struct A1 *p)
+{
+ p->a1[0] = 0;
+ p->a1[1] = 1; // { dg-warning "\\\[-Warray-bounds" }
+ p->a1[2] = 2; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void warn_a1_init (struct A1 *p)
+{
+ p->a1[0] = 0;
+ p->a1[1] = 1; // { dg-warning "\\\[-Warray-bounds" }
+ p->a1[2] = 2; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void warn_a1_local_buf (struct A1 *p)
+{
+ p->a1[0] = 0; p->a1[1] = 1; p->a1[2] = 2; p->a1[3] = 3;
+
+ p->a1[4] = 4; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void warn_a1_extern_buf (struct A1 *p)
+{
+ p->a1[0] = 0; p->a1[1] = 1; p->a1[2] = 2; p->a1[3] = 3; p->a1[4] = 4;
+
+ p->a1[5] = 5; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void nowarn_a1_extern_bufx (struct A1 *p)
+{
+ p->a1[0] = 0; p->a1[99] = 99; p->a1[999] = 999; p->a1[9999] = 9999;
+}
+
+static void nowarn_a1_ref (struct A1 *p)
+{
+ p->a1[0] = 0; p->a1[99] = 99; p->a1[999] = 999; p->a1[9999] = 9999;
+}
+
+void test_a1 (struct A1 *p, unsigned n)
+{
+ {
+ struct A1 a1;
+ warn_a1_local_noinit (&a1);
+ sink (&a1);
+ }
+
+ {
+ extern struct A1 a1x;
+ warn_a1_extern (&a1x);
+ sink (&a1x);
+}
+ {
+ struct A1 a1 = { 0, { 1 } };
+ warn_a1_init (&a1);
+ sink (&a1);
+ }
+
+ {
+ /* Verify out-of-bounds access to the local BUF is diagnosed. */
+ char buf_p2[sizeof (struct A1) + 2 * sizeof (int16_t)];
+ warn_a1_local_buf ((struct A1*) buf_p2);
+ sink (buf_p2);
+ }
+
+ {
+ /* Verify out-of-bounds access to the extern BUF with a known
+ bound is diagnosed. */
+ extern char a1_buf_p3[sizeof (struct A1) + 3 * sizeof (int16_t)];
+ warn_a1_extern_buf ((struct A1*) a1_buf_p3);
+ sink (a1_buf_p3);
+ }
+
+ {
+ /* Verify that accesses to BUFX with an unknown bound are not
+ diagnosed. */
+ extern char bufx[];
+ nowarn_a1_extern_bufx ((struct A1*) bufx);
+ sink (bufx);
+ }
+
+ {
+ /* Verify that accesses to BUFN with a runtime bound are not
+ diagnosed. */
+ char bufn[n];
+ nowarn_a1_extern_bufx ((struct A1*) bufn);
+ sink (bufn);
+ }
+
+ nowarn_a1_ref (p);
+}
+
+
+/* Exercise a two-element trailing member array. It's treated
+ the same as an interior array member. */
+
+struct A2
+{
+ int32_t n;
+ int16_t a2[2]; // { dg-message "while referencing 'a2'" }
+};
+
+static void warn_a2_noinit (struct A2 *p)
+{
+ p->a2[0] = 0; p->a2[1] = 1;
+
+ p->a2[2] = 2; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void warn_a2_init (struct A2 *p)
+{
+ p->a2[0] = 0; p->a2[1] = 1;
+
+ p->a2[2] = 2; // { dg-warning "\\\[-Warray-bounds" }
+ p->a2[9] = 9; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+static void warn_a2_ref (struct A2 *p)
+{
+ p->a2[0] = 0; p->a2[1] = 1;
+
+ p->a2[2] = 2; // { dg-warning "\\\[-Warray-bounds" }
+ p->a2[9] = 9; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+void test_a2 (struct A2 *p)
+{
+ {
+ struct A2 a2;
+ warn_a2_noinit (&a2);
+ sink (&a2);
+ }
+
+ {
+ struct A2 a2 = { 0, { 1, 2 } };
+ warn_a2_init (&a2);
+ sink (&a2);
+ }
+
+ warn_a2_ref (p);
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-48.c b/gcc/testsuite/gcc.dg/Warray-bounds-48.c
index 13373d1..19b7634c 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-48.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-48.c
@@ -30,7 +30,7 @@ static void nowarn_ax_extern (struct AX *p)
static void warn_ax_local_buf (struct AX *p)
{
- p->ax[0] = 4; p->ax[1] = 5;
+ p->ax[0] = 4; p->ax[1] = 5; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v2hi_store && { ! vect_slp_v4hi_store } } } }
p->ax[2] = 6; // { dg-warning "\\\[-Warray-bounds" }
p->ax[3] = 7; // { dg-warning "\\\[-Warray-bounds" }
@@ -130,7 +130,7 @@ static void warn_a0_extern (struct A0 *p)
static void warn_a0_local_buf (struct A0 *p)
{
- p->a0[0] = 4; p->a0[1] = 5;
+ p->a0[0] = 4; p->a0[1] = 5; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v2hi_store && { ! vect_slp_v4hi_store } } } }
p->a0[2] = 6; // { dg-warning "\\\[-Warray-bounds" }
p->a0[3] = 7; // { dg-warning "\\\[-Warray-bounds" }
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c b/gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c
new file mode 100644
index 0000000..ef8056d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-51-novec.c
@@ -0,0 +1,21 @@
+/* PR middle-end/92333 - missing variable name referencing VLA in warnings
+ PR middle-end/82608 - missing -Warray-bounds on an out-of-bounds VLA index
+ { dg-do compile }
+ { dg-options "-O2 -Wall -fno-tree-vectorize" } */
+
+void sink (void*);
+
+void test_struct_char_vla_location (void)
+{
+ unsigned nelts = 7;
+
+ struct {
+ char cvla[nelts]; // { dg-message "declared here|while referencing" }
+ } s;
+
+ s.cvla[0] = __LINE__;
+ s.cvla[nelts - 1] = 0;
+ s.cvla[nelts] = 0; // { dg-warning "\\\[-Warray-bounds" }
+
+ sink (&s);
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-51.c b/gcc/testsuite/gcc.dg/Warray-bounds-51.c
index b0b8bdb..8b589f3 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-51.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-51.c
@@ -1,7 +1,8 @@
/* PR middle-end/92333 - missing variable name referencing VLA in warnings
PR middle-end/82608 - missing -Warray-bounds on an out-of-bounds VLA index
{ dg-do compile }
- { dg-options "-O2 -Wall" } */
+ { dg-options "-O2 -Wall" }
+ { dg-additional-options "-mtune=generic" { target { i?86-*-* x86_64-*-* } } } */
void sink (void*);
@@ -38,7 +39,7 @@ void test_struct_char_vla_location (void)
} s;
s.cvla[0] = __LINE__;
- s.cvla[nelts - 1] = 0; // { dg-warning "\\\[-Wstringop-overflow" { target { i?86-*-* x86_64-*-* } } }
+ s.cvla[nelts - 1] = 0; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v2qi_store } } }
s.cvla[nelts] = 0; // { dg-warning "\\\[-Warray-bounds" }
sink (&s);
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-87.c b/gcc/testsuite/gcc.dg/Warray-bounds-87.c
index a49874d..a545780 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-87.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-87.c
@@ -33,7 +33,7 @@ static unsigned int h (int i, int j)
case 9:
return j;
case 10:
- return a[i]; // { dg-bogus "-Warray-bounds" "pr101671" { xfail *-*-* } }
+ return a[i]; // { dg-bogus "-Warray-bounds" "pr101671" }
}
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-90.c b/gcc/testsuite/gcc.dg/Warray-bounds-90.c
new file mode 100644
index 0000000..1ff6077
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-90.c
@@ -0,0 +1,147 @@
+/* PR middle-end/102453 - buffer overflow by atomic built-ins not diagnosed
+ Verify that out-of-bounds accesses by atomic functions are diagnosed.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -ftrack-macro-expansion=0" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+#define load __atomic_load
+#define store __atomic_store
+#define add_fetch __atomic_add_fetch
+#define sub_fetch __atomic_sub_fetch
+#define and_fetch __atomic_and_fetch
+#define or_fetch __atomic_or_fetch
+#define xor_fetch __atomic_xor_fetch
+#define nand_fetch __atomic_nand_fetch
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*, ...);
+#define sink(...) sink (0, __VA_ARGS__)
+
+extern _Bool eb;
+extern char ec;
+extern short int esi;
+extern int ei;
+extern long int eli;
+extern long long int elli;
+
+extern const _Bool ecb;
+extern const char ecc;
+extern const short int ecsi;
+extern const int eci;
+extern const long int ecli;
+extern const long long int eclli;
+
+extern _Atomic _Bool eab;
+extern _Atomic char eac;
+extern _Atomic short int easi;
+extern _Atomic int eai;
+extern _Atomic long int eali;
+extern _Atomic long long int ealli;
+
+extern _Atomic const _Bool eacb;
+extern _Atomic const char eacc;
+extern _Atomic const short int eacsi;
+extern _Atomic const int eaci;
+extern _Atomic const long int eacli;
+extern _Atomic const long long int eaclli;
+
+
+void nowarn_atomic_load (void)
+{
+ load (&eacb, &eb, 0);
+ load (&eacc, &ec, 0);
+ load (&eacsi, &esi, 0);
+ load (&eaci, &ei, 0);
+ load (&eacli, &eli, 0);
+ load (&eaclli, &elli, 0);
+}
+
+
+void warn_atomic_load_note (void)
+{
+ int i; // { dg-message "'i'" }
+
+ int *pi = (int*)((char*)&i + 1);
+ load (&eaci, pi, 0); // { dg-warning "-Warray-bounds" }
+ sink (&i);
+
+ pi = (int*)((char*)&i + 2);
+ load (&eaci, pi, 0); // { dg-warning "-Warray-bounds" }
+ sink (&i);
+
+ pi = &i + 1;
+ load (&eaci, pi, 0); // { dg-warning "-Warray-bounds" }
+ sink (&i);
+}
+
+
+void warn_atomic_load (void)
+{
+ bool *pb = &eb + 1;
+ load (&eacb, pb, 0); // { dg-warning "-Warray-bounds" }
+
+ char *pc = &ec + 1;
+ load (&eacc, pc, 0); // { dg-warning "-Warray-bounds" }
+
+ short *psi = (short*)((char*)&esi + 1);
+ load (&eacsi, psi, 0); // { dg-warning "-Warray-bounds" }
+ psi = (short*)((char*)&esi + 2);
+ load (&eacsi, psi, 0); // { dg-warning "-Warray-bounds" }
+
+ int *pi = (int*)((char*)&ei + 1);
+ load (&eaci, pi, 0); // { dg-warning "-Warray-bounds" }
+ pi = (int*)((char*)&ei + 2);
+ load (&eaci, pi, 0); // { dg-warning "-Warray-bounds" }
+ pi = (int*)((char*)&ei + sizeof ei);
+ load (&eaci, pi, 0); // { dg-warning "-Warray-bounds" }
+
+ long *pli = (long*)((char*)&eli + 1);
+ load (&eacli, pli, 0); // { dg-warning "-Warray-bounds" }
+ pli = (long*)((char*)&eli + 1);
+ load (&eacli, pli, 0); // { dg-warning "-Warray-bounds" }
+ pli = &eli + 1;
+ load (&eacli, pli, 0); // { dg-warning "-Warray-bounds" }
+
+ long long *plli = (long long*)((char*)&elli + 1);
+ load (&eaclli, plli, 0); // { dg-warning "-Warray-bounds" }
+ plli = (long long*)((char*)&elli + 1);
+ load (&eaclli, plli, 0); // { dg-warning "-Warray-bounds" }
+ plli = &elli + 1;
+ load (&eaclli, plli, 0); // { dg-warning "-Warray-bounds" }
+}
+
+
+void warn_atomic_store (void)
+{
+ const bool *pb = &eb + 1;
+ store (&eab, pb, 0); // { dg-warning "-Warray-bounds" }
+
+ const char *pc = &ec + 1;
+ store (&eac, pc, 0); // { dg-warning "-Warray-bounds" }
+
+ const short *psi = (const short*)((const char*)&ecsi + 1);
+ store (&easi, psi, 0); // { dg-warning "-Warray-bounds" }
+ psi = (const short*)((const char*)&esi + 2);
+ store (&easi, psi, 0); // { dg-warning "-Warray-bounds" }
+
+ const int *pi = (const int*)((const char*)&eci + 1);
+ store (&eai, pi, 0); // { dg-warning "-Warray-bounds" }
+ pi = (const int*)((const char*)&ei + 2);
+ store (&eai, pi, 0); // { dg-warning "-Warray-bounds" }
+ pi = (const int*)((const char*)&ei + sizeof ei);
+ store (&eai, pi, 0); // { dg-warning "-Warray-bounds" }
+
+ const long *pli = (const long*)((const char*)&eli + 1);
+ store (&eali, pli, 0); // { dg-warning "-Warray-bounds" }
+ pli = (const long*)((const char*)&eli + sizeof (eli));
+ store (&eali, pli, 0); // { dg-warning "-Warray-bounds" }
+
+ const long long *plli = (const long long*)((const char*)&elli + 1);
+ store (&ealli, plli, 0); // { dg-warning "-Warray-bounds" }
+ plli = (const long long*)((const char*)&elli + sizeof elli);
+ store (&ealli, plli, 0); // { dg-warning "-Warray-bounds" }
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-parameter-3-novec.c b/gcc/testsuite/gcc.dg/Warray-parameter-3-novec.c
new file mode 100644
index 0000000..5089d55
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-parameter-3-novec.c
@@ -0,0 +1,16 @@
+/* PR c/50584 - No warning for passing small array to C99 static array
+ declarator
+ { dg-do compile }
+ { dg-options "-Wall -Warray-parameter=1" } */
+
+/* Also verify that -Warray-bounds doesn't trigger for ordinary array
+ parameters... */
+#pragma GCC optimize ("2,no-tree-vectorize")
+
+/* ...but does for static arrays. */
+__attribute__ ((noipa)) void
+gcas3 (char a[static 3])
+{
+ a[0] = 0; a[1] = 1; a[2] = 2;
+ a[3] = 3; // { dg-warning "\\\[-Warray-bounds" }
+}
diff --git a/gcc/testsuite/gcc.dg/Warray-parameter-3.c b/gcc/testsuite/gcc.dg/Warray-parameter-3.c
index e2c47e1..b6ed8da 100644
--- a/gcc/testsuite/gcc.dg/Warray-parameter-3.c
+++ b/gcc/testsuite/gcc.dg/Warray-parameter-3.c
@@ -77,7 +77,7 @@ gia3 (int a[3])
__attribute__ ((noipa)) void
gcas3 (char a[static 3])
{
- a[0] = 0; a[1] = 1; a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" { target { i?86-*-* x86_64-*-* } } }
+ a[0] = 0; a[1] = 1; a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v4qi_store } } }
a[3] = 3; // { dg-warning "\\\[-Warray-bounds" }
}
diff --git a/gcc/testsuite/gcc.dg/Wrestrict-23.c b/gcc/testsuite/gcc.dg/Wrestrict-23.c
new file mode 100644
index 0000000..c7a828b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wrestrict-23.c
@@ -0,0 +1,146 @@
+/* PR tree-optimization/102238 - missing -Wrestrict on sprintf formatting
+ a struct member into enclosing object
+ { dg-do compile }
+ { dg-options "-O2 -Wall -Wno-format-overflow" } */
+
+extern int sprintf (char*, const char*, ...);
+
+extern void sink (void*, ...);
+
+struct A
+{
+ char a[4];
+};
+
+struct B
+{
+ struct A a1, a2;
+};
+
+extern struct B eb;
+
+enum { B_a2_a_off = __builtin_offsetof (struct B, a2.a) };
+
+
+void test_warn_src_decl_plus (void)
+{
+ {
+ char *s = (char*)&eb + B_a2_a_off;
+ char *d = eb.a2.a;
+ sprintf (d, "%s", s); // { dg-warning "overlaps" }
+ }
+
+ {
+ // If strlen (s) > 0 there is overlap with a[1].
+ char *s = (char*)&eb + B_a2_a_off + 1;
+ char *d = eb.a2.a;
+ sprintf (d, "%s", s); // { dg-warning "may overlap" }
+ }
+
+ {
+ // strlen (s) must be at most 1 so there can be no overlap with a.
+ char *s = (char*)&eb + B_a2_a_off + 2;
+ char *d = eb.a2.a;
+ sprintf (d, "%s", s); // { dg-bogus "-Wrestrict" }
+ }
+
+ {
+ // strlen (s) must be at most 0 so there can be no overlap with a.
+ char *s = (char*)&eb + B_a2_a_off + 3;
+ char *d = eb.a2.a;
+ sprintf (d, "%s", s); // { dg-bogus "-Wrestrict" }
+ }
+}
+
+
+void test_warn_src_ptr_plus (struct B *p)
+{
+ {
+ char *s = (char*)p + B_a2_a_off;
+ char *d = p->a2.a;
+ sprintf (d, "%s", s); // { dg-warning "overlaps" }
+ }
+
+ {
+ // If strlen (s) > 0 there is overlap with a[1].
+ char *s = (char*)p + B_a2_a_off + 1;
+ char *d = p->a2.a;
+ sprintf (d, "%s", s); // { dg-warning "may overlap" }
+ }
+
+ {
+ // strlen (s) must be at most 1 so there can be no overlap with a.
+ char *s = (char*)p + B_a2_a_off + 2;
+ char *d = p->a2.a;
+ sprintf (d, "%s", s); // { dg-bogus "-Wrestrict" }
+ }
+
+ {
+ // strlen (s) must be at most 0 so there can be no overlap with a.
+ char *s = (char*)p + B_a2_a_off + 3;
+ char *d = p->a2.a;
+ sprintf (d, "%s", s); // { dg-bogus "-Wrestrict" }
+ }
+}
+
+
+void test_warn_dst_decl_plus (void)
+{
+ {
+ char *s = eb.a2.a;
+ char *d = (char*)&eb + B_a2_a_off;
+ sprintf (d, "%s", s); // { dg-warning "overlaps" }
+ }
+
+ {
+ // If strlen (a) > 0 there is overlap with a[1].
+ char *s = eb.a2.a;
+ char *d = (char*)&eb + B_a2_a_off + 1;
+ sprintf (d, "%s", s); // { dg-warning "may overlap" }
+ }
+
+ {
+ // If strlen (a) > 1 there is overlap with a[2].
+ char *s = eb.a2.a;
+ char *d = (char*)&eb + B_a2_a_off + 2;
+ sprintf (d, "%s", s); // { dg-warning "may overlap" }
+ }
+
+ {
+ // If strlen (a) > 2 there is overlap with a[3].
+ char *s = eb.a2.a;
+ char *d = (char*)&eb + B_a2_a_off + 3;
+ sprintf (d, "%s", s); // { dg-warning "may overlap" }
+ }
+}
+
+
+void test_warn_dst_ptr_plus (struct B *p)
+{
+ {
+ char *s = p->a2.a;
+ char *d = (char*)p + B_a2_a_off;
+ sprintf (d, "%s", s); // { dg-warning "overlaps" }
+ }
+
+ {
+ // If strlen (a) > 0 there is overlap with a[1].
+ char *s = p->a2.a;
+ char *d = (char*)p + B_a2_a_off + 1;
+ sprintf (d, "%s", s); // { dg-warning "may overlap" }
+ }
+
+ {
+ // If strlen (a) > 1 there is overlap with a[2].
+ char *s = p->a2.a;
+ char *d = (char*)p + B_a2_a_off + 2;
+ sprintf (d, "%s", s); // { dg-warning "may overlap" }
+ }
+
+ {
+ // If strlen (a) > 2 there is overlap with a[3].
+ char *s = p->a2.a;
+ char *d = (char*)p + B_a2_a_off + 3;
+ sprintf (d, "%s", s); // { dg-warning "may overlap" }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-14-novec.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-14-novec.c
new file mode 100644
index 0000000..de39eaa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-14-novec.c
@@ -0,0 +1,16 @@
+/* Test to verify that past-the-end multibyte writes via lvalues of wider
+ types than char are diagnosed.
+ { dg-do compile }
+ { dg-require-effective-target int32plus }
+ { dg-options "-O2 -fno-tree-vectorize -Wall -Wno-array-bounds" } */
+
+typedef __INT16_TYPE__ int16_t;
+
+char a4[4], a8[8], a16[16];
+
+void test_int16 (void)
+{
+ char *p = a4 + 1;
+ *(int16_t*)p = 0;
+ *(int16_t*)(p + 2) = 0; // { dg-warning "writing 2 bytes into a region of size 1" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c
index b648f5b..c4a3f05 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c
@@ -2,7 +2,8 @@
types than char are diagnosed.
{ dg-do compile }
{ dg-require-effective-target int32plus }
- { dg-options "-O2 -Wall -Wno-array-bounds" } */
+ { dg-options "-O2 -Wall -Wno-array-bounds" }
+ { dg-additional-options "-mtune=generic" { target { i?86-*-* x86_64-*-* } } } */
typedef __INT16_TYPE__ int16_t;
typedef __INT32_TYPE__ int32_t;
@@ -35,8 +36,8 @@ void test_memcpy_cond (int i)
void test_int16 (void)
{
char *p = a4 + 1;
- *(int16_t*)p = 0; // { dg-warning "writing 4 bytes into a region of size 3" { target { i?86-*-* x86_64-*-* } } }
- *(int16_t*)(p + 2) = 0; // { dg-warning "writing 2 bytes into a region of size 1" "" { xfail { i?86-*-* x86_64-*-* } } }
+ *(int16_t*)p = 0; // { dg-warning "writing 4 bytes into a region of size 3" "pr102706" { target { vect_slp_v2hi_store } } }
+ *(int16_t*)(p + 2) = 0; // { dg-warning "writing 2 bytes into a region of size 1" "pr102706" { xfail { vect_slp_v2hi_store } } }
}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-21-novec.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-21-novec.c
new file mode 100644
index 0000000..6f83548
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-21-novec.c
@@ -0,0 +1,34 @@
+/* PR middle-end/92312 - bogus -Wstringop-overflow storing into a trailing
+ array backed by larger buffer
+ { dg-do compile }
+ { dg-options "-O2 -fno-tree-vectorize -Wall -Wno-array-bounds" } */
+
+struct S0 { char a, b[0]; };
+
+void sink (void*);
+
+void test_store_zero_length (int i)
+{
+ char a[3];
+ struct S0 *p = (struct S0*)a;
+ p->a = 0;
+ p->b[0] = 0;
+ p->b[1] = 1; // { dg-bogus "\\\[-Wstringop-overflow" }
+ p->b[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" }
+ p->b[i] = 2;
+ sink (p);
+}
+
+struct Sx { char a, b[]; };
+
+void test_store_flexarray (int i)
+{
+ char a[3];
+ struct Sx *p = (struct Sx*)a;
+ p->a = 0;
+ p->b[0] = 0;
+ p->b[1] = 1; // { dg-bogus "\\\[-Wstringop-overflow" }
+ p->b[2] = 1; // { dg-warning "\\\[-Wstringop-overflow" }
+ p->b[i] = 2;
+ sink (p);
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-21.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-21.c
index e88f7b4..3fccfc9 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-21.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-21.c
@@ -23,10 +23,10 @@ void test_store_zero_length (int i)
{
char a[3];
struct S0 *p = (struct S0*)a;
- p->a = 0; // { dg-warning "\\\[-Wstringop-overflow" { target { i?86-*-* x86_64-*-* } } }
+ p->a = 0; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v4qi_store } } }
p->b[0] = 0;
p->b[1] = 1; // { dg-bogus "\\\[-Wstringop-overflow" }
- p->b[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { i?86-*-* x86_64-*-* } } }
+ p->b[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { xfail { vect_slp_v4qi_store } } }
p->b[i] = 2;
sink (p);
}
@@ -50,10 +50,10 @@ void test_store_flexarray (int i)
{
char a[3];
struct Sx *p = (struct Sx*)a;
- p->a = 0; // { dg-warning "\\\[-Wstringop-overflow" { target { i?86-*-* x86_64-*-* } } }
+ p->a = 0; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v4qi_store } } }
p->b[0] = 0;
p->b[1] = 1; // { dg-bogus "\\\[-Wstringop-overflow" }
- p->b[2] = 1; // { dg-warning "\\\[-Wstringop-overflow" "" { xfail { i?86-*-* x86_64-*-* } } }
+ p->b[2] = 1; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { xfail { vect_slp_v4qi_store } } }
p->b[i] = 2;
sink (p);
}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-22.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-22.c
index 8eaaa71..764b199 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-22.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-22.c
@@ -260,13 +260,12 @@ T (puts_unlocked, a); // { dg-warning "missing terminating nul" "puts_unlo
// Exerise exec functions.
T (execl, a, s, NULL); // { dg-warning "missing terminating nul" "execl" }
-T (execl, a, s, NULL); // { dg-warning "missing terminating nul" "execl" }
-T (execle, a, s, NULL, NULL); // { dg-warning "missing terminating nul" "execl" }
-T (execlp, a, s, NULL); // { dg-warning "missing terminating nul" "execl" }
+T (execle, a, s, NULL, NULL); // { dg-warning "missing terminating nul" "execle" }
+T (execlp, a, s, NULL); // { dg-warning "missing terminating nul" "execlp" }
-T (execv, a, &d); // { dg-warning "missing terminating nul" "execl" }
-T (execve, a, &d, &d); // { dg-warning "missing terminating nul" "execl" }
-T (execvp, a, &d); // { dg-warning "missing terminating nul" "execl" }
+T (execv, a, &d); // { dg-warning "missing terminating nul" "execv" }
+T (execve, a, &d, &d); // { dg-warning "missing terminating nul" "execve" }
+T (execvp, a, &d); // { dg-warning "missing terminating nul" "execvp" }
T (gettext, a); // { dg-warning "missing terminating nul" "gettext" }
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-68.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-68.c
index 09df000..04e91af 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-68.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-68.c
@@ -58,11 +58,18 @@ void warn_comp_lit_zero (void)
void warn_comp_lit (void)
{
*(AC2*)a1 = Ac2; // { dg-warning "writing 2 bytes into a region of size 1" "pr101475" { xfail *-*-* } }
- *(AC4*)a2 = Ac4; // { dg-warning "writing 4 bytes into a region of size 2" "pr101475" { xfail { ! { i?86-*-* x86_64-*-* } } } }
- *(AC4*)a3 = Ac4; // { dg-warning "writing 4 bytes into a region of size 3" "pr101475" { xfail { ! { i?86-*-* x86_64-*-* } } } }
- *(AC8*)a4 = Ac8; // { dg-warning "writing 8 bytes into a region of size 4" "pr101475" { xfail { ! { i?86-*-* x86_64-*-* } } } }
- *(AC8*)a7 = Ac8; // { dg-warning "writing 8 bytes into a region of size 7" "pr101475" { xfail { ! { i?86-*-* x86_64-*-* } } } }
- *(AC16*)a15 = Ac16; // { dg-warning "writing 16 bytes into a region of size 15" "pr101475" { xfail { ! { i?86-*-* x86_64-*-* } } } }
+ // After vectorization, below codes are optimized to
+ // MEM <vector(4) char> [(char *)&a2] = { 0, 1, 2, 3 };
+ // MEM <vector(4) char> [(char *)&a3] = { 0, 1, 2, 3 };
+ // MEM <vector(8) char> [(char *)&a4] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+ // MEM <vector(8) char> [(char *)&a7] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+ // MEM <vector(16) char> [(char *)&a15] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
+ // and warning should be expected, refer to PR102722.
+ *(AC4*)a2 = Ac4; // { dg-warning "writing 4 bytes into a region of size 2" "pr101475" { xfail { ! { vect_slp_v4qi_store } } } }
+ *(AC4*)a3 = Ac4; // { dg-warning "writing 4 bytes into a region of size 3" "pr101475" { xfail { ! { vect_slp_v4qi_store } } } }
+ *(AC8*)a4 = Ac8; // { dg-warning "writing 8 bytes into a region of size 4" "pr101475" { xfail { ! { vect_slp_v8qi_store } } } }
+ *(AC8*)a7 = Ac8; // { dg-warning "writing 8 bytes into a region of size 7" "pr101475" { xfail { ! { vect_slp_v8qi_store } } } }
+ *(AC16*)a15 = Ac16; // { dg-warning "writing 16 bytes into a region of size 15" "pr101475" { xfail { ! { vect_slp_v16qi_store } } } }
}
void warn_aggr_decl (void)
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c
new file mode 100644
index 0000000..71c643b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-76-novec.c
@@ -0,0 +1,88 @@
+/* Verify warnings and notes for MAX_EXPRs involving either pointers
+ to distinct objects or one to a known object and the other to
+ an unknown one. Unlike for the same object, for unrelated objects
+ the expected warnings and notes are the same as for MIN_EXPR: when
+ the order of the objects in the address space cannot be determined
+ the larger of them is assumed to be used. (This is different for
+ distinct struct members where the order is given.)
+ The relational expressions are strictly invalid but that should be
+ diagnosed by a separate warning.
+ { dg-do compile }
+ { dg-options "-O2 -Wno-array-bounds -fno-tree-vectorize" } */
+
+#define MAX(p, q) ((p) > (q) ? (p) : (q))
+
+/* Verify that even for MAX_EXPR and like for MIN_EXPR, the note points
+ to the larger of the two objects and mentions the offset into it
+ (although the offset might be better included in the warning). */
+extern char a3[3];
+extern char a5[5]; // { dg-message "at offset 5 into destination object 'a5' of size 5" "note" }
+
+void max_a3_a5 (int i)
+{
+ char *p = a3 + i;
+ char *q = a5 + i;
+
+ /* The relational expression below is invalid and should be diagnosed
+ by its own warning independently of -Wstringop-overflow. */
+ char *d = MAX (p, q);
+
+ d[2] = 0;
+ d[3] = 0;
+ d[4] = 0;
+ d[5] = 0; // { dg-warning "writing 1 byte into a region of size 0" }
+}
+
+
+// Same as above but with the larger array as the first MAX_EXPR operand.
+extern char b4[4];
+extern char b6[6]; // { dg-message "at offset 6 into destination object 'b6' of size 6" "note" }
+
+void max_b6_b4 (int i)
+{
+ char *p = b6 + i;
+ char *q = b4 + i;
+ char *d = MAX (p, q);
+
+ d[3] = 0;
+ d[4] = 0;
+ d[5] = 0;
+ d[6] = 0; // { dg-warning "writing 1 byte into a region of size 0" }
+}
+
+struct A3_5
+{
+ char a3[3]; // { dg-message "at offset 3 into destination object 'a3' of size 3" "pr??????" { xfail *-*-* } }
+ char a5[5]; // { dg-message "at offset 5 into destination object 'a5' of size 5" "note" }
+};
+
+void max_A3_A5 (int i, struct A3_5 *pa3_5)
+{
+ char *p = pa3_5->a3 + i;
+ char *q = pa3_5->a5 + i;
+
+ char *d = MAX (p, q);
+ d[2] = 0;
+ d[3] = 0; // { dg-warning "writing 1 byte into a region of size 0" "pr??????" { xfail *-*-* } }
+ d[4] = 0;
+ d[5] = 0; // { dg-warning "writing 1 byte into a region of size 0" }
+}
+
+
+struct B4_B6
+{
+ char b4[4];
+ char b6[6]; // { dg-message "at offset 6 into destination object 'b6' of size 6" "note" }
+};
+
+void max_B6_B4 (int i, struct B4_B6 *pb4_b6)
+{
+ char *p = pb4_b6->b6 + i;
+ char *q = pb4_b6->b4 + i;
+ char *d = MAX (p, q);
+
+ d[3] = 0;
+ d[4] = 0;
+ d[5] = 0;
+ d[6] = 0; // { dg-warning "writing 1 byte into a region of size 0" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-76.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-76.c
index 30b1c9a..5246726 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-76.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-76.c
@@ -27,10 +27,10 @@ void max_a3_a5 (int i)
by its own warning independently of -Wstringop-overflow. */
char *d = MAX (p, q);
- d[2] = 0; // { dg-warning "writing 4 bytes into a region of size 3" { target { i?86-*-* x86_64-*-* } } }
+ d[2] = 0; // { dg-warning "writing 4 bytes into a region of size 3" "pr102706" { target { vect_slp_v4qi_store } } }
d[3] = 0;
d[4] = 0;
- d[5] = 0; // { dg-warning "writing 1 byte into a region of size 0" "" { xfail { i?86-*-* x86_64-*-* } } }
+ d[5] = 0; // { dg-warning "writing 1 byte into a region of size 0" "pr102706" { xfail { vect_slp_v4qi_store } } }
}
@@ -44,10 +44,10 @@ void max_b6_b4 (int i)
char *q = b4 + i;
char *d = MAX (p, q);
- d[3] = 0; // { dg-warning "writing 4 bytes into a region of size 3" { target { i?86-*-* x86_64-*-* } } }
+ d[3] = 0; // { dg-warning "writing 4 bytes into a region of size 3" "pr102706" { target { vect_slp_v4qi_store } } }
d[4] = 0;
d[5] = 0;
- d[6] = 0; // { dg-warning "writing 1 byte into a region of size 0" "" { xfail { i?86-*-* x86_64-*-* } } }
+ d[6] = 0; // { dg-warning "writing 1 byte into a region of size 0" "pr102706" { xfail { vect_slp_v4qi_store } } }
}
@@ -82,7 +82,8 @@ void max_d8_p (char *q, int i)
struct A3_5
{
char a3[3]; // { dg-message "at offset 3 into destination object 'a3' of size 3" "pr??????" { xfail *-*-* } }
- char a5[5]; // { dg-message "at offset 5 into destination object 'a5' of size 5" "note" { xfail { i?86-*-* x86_64-*-* } } }
+ // refer to pr102697 for xfail
+ char a5[5]; // { dg-message "at offset 5 into destination object 'a5' of size 5" "note" { xfail { vect_slp_v4qi_store } } }
};
void max_A3_A5 (int i, struct A3_5 *pa3_5)
@@ -95,14 +96,15 @@ void max_A3_A5 (int i, struct A3_5 *pa3_5)
d[2] = 0;
d[3] = 0; // { dg-warning "writing 1 byte into a region of size 0" "pr??????" { xfail *-*-* } }
d[4] = 0;
- d[5] = 0; // { dg-warning "writing 1 byte into a region of size 0" "" { xfail { i?86-*-* x86_64-*-* } } }
+ d[5] = 0; // { dg-warning "writing 1 byte into a region of size 0" "pr102697" { xfail { vect_slp_v4qi_store } } }
}
struct B4_B6
{
char b4[4];
- char b6[6]; // { dg-message "at offset \[^a-zA-Z\n\r\]*6\[^a-zA-Z0-9\]* into destination object 'b6' of size 6" "note" { xfail { i?86-*-* x86_64-*-* } } }
+ // refer to pr102697 for xfail
+ char b6[6]; // { dg-message "at offset \[^a-zA-Z\n\r\]*6\[^a-zA-Z0-9\]* into destination object 'b6' of size 6" "note" { xfail { vect_slp_v4qi_store } } }
};
void max_B6_B4 (int i, struct B4_B6 *pb4_b6)
@@ -114,7 +116,7 @@ void max_B6_B4 (int i, struct B4_B6 *pb4_b6)
d[3] = 0;
d[4] = 0;
d[5] = 0;
- d[6] = 0; // { dg-warning "writing 1 byte into a region of size 0" "" { xfail { i?86-*-* x86_64-*-* } } }
+ d[6] = 0; // { dg-warning "writing 1 byte into a region of size 0" "pr102697" { xfail { vect_slp_v4qi_store } } }
}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-77.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-77.c
new file mode 100644
index 0000000..732f568
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-77.c
@@ -0,0 +1,516 @@
+/* PR middle-end/102453 - buffer overflow by atomic built-ins not diagnosed
+ Verify that out-of-bounds accesses by atomic functions are diagnosed with
+ optimization disabled.
+ { dg-do compile }
+ { dg-options "-O0 -Wall -ftrack-macro-expansion=0" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+#define add_fetch(p, q) __atomic_add_fetch (p, q, 0)
+#define sub_fetch(p, q) __atomic_sub_fetch (p, q, 0)
+#define and_fetch(p, q) __atomic_and_fetch (p, q, 0)
+#define or_fetch(p, q) __atomic_or_fetch (p, q, 0)
+#define xor_fetch(p, q) __atomic_xor_fetch (p, q, 0)
+#define nand_fetch(p, q) __atomic_nand_fetch (p, q, 0)
+#define exchange(p, q, r) __atomic_exchange (p, q, r, 0)
+#define exchange_n(p, n) __atomic_exchange_n (p, n, 0)
+#define cmpxchg(p, q, r) __atomic_compare_exchange (p, q, r, 0, 0, 0)
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*, ...);
+#define sink(...) sink (0, __VA_ARGS__)
+
+extern _Bool eb;
+extern char ec;
+extern short int esi;
+extern int ei;
+extern long int eli;
+extern long long int elli;
+
+extern const _Bool ecb;
+extern const char ecc;
+extern const short int ecsi;
+extern const int eci;
+extern const long int ecli;
+extern const long long int eclli;
+
+extern _Atomic _Bool eab;
+extern _Atomic char eac;
+extern _Atomic short int easi;
+extern _Atomic int eai;
+extern _Atomic long int eali;
+extern _Atomic long long int ealli;
+
+extern _Atomic const _Bool eacb;
+extern _Atomic const char eacc;
+extern _Atomic const short int eacsi;
+extern _Atomic const int eaci;
+extern _Atomic const long int eacli;
+extern _Atomic const long long int eaclli;
+
+
+void nowarn_atomic_add_fetch (void)
+{
+ add_fetch (&eac, ecc);
+ add_fetch (&easi, esi);
+ add_fetch (&eai, ei);
+ add_fetch (&eali, eli);
+ add_fetch (&ealli, elli);
+}
+
+
+void warn_atomic_add_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ add_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ add_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ add_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ add_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ add_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ add_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ add_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ add_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ add_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ add_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ add_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ add_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+void nowarn_atomic_sub_fetch (void)
+{
+ _Atomic char *pc = &eac;
+ sub_fetch (pc, ecc);
+
+ _Atomic short *psi = &easi;
+ sub_fetch (psi, esi);
+
+ _Atomic int *pi = &eai;
+ sub_fetch (pi, ei);
+
+ _Atomic long *pli = &eali;
+ sub_fetch (pli, eli);
+
+ _Atomic long long *plli = &ealli;
+ sub_fetch (plli, elli);
+}
+
+
+void warn_atomic_sub_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ sub_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ sub_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ sub_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ sub_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ sub_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ sub_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ sub_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ sub_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ sub_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ sub_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ sub_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ sub_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+void nowarn_atomic_and_fetch (void)
+{
+ _Atomic char *pc = &eac;
+ and_fetch (pc, ecc);
+
+ _Atomic short *psi = &easi;
+ and_fetch (psi, esi);
+
+ _Atomic int *pi = &eai;
+ and_fetch (pi, ei);
+
+ _Atomic long *pli = &eali;
+ and_fetch (pli, eli);
+
+ _Atomic long long *plli = &ealli;
+ and_fetch (plli, elli);
+}
+
+
+void warn_atomic_and_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ and_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ and_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ and_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ and_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ and_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ and_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ and_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ and_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ and_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ and_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ and_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ and_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+void nowarn_atomic_or_fetch (void)
+{
+ _Atomic char *pc = &eac;
+ or_fetch (pc, ecc);
+
+ _Atomic short *psi = &easi;
+ or_fetch (psi, esi);
+
+ _Atomic int *pi = &eai;
+ or_fetch (pi, ei);
+
+ _Atomic long *pli = &eali;
+ or_fetch (pli, eli);
+
+ _Atomic long long *plli = &ealli;
+ or_fetch (plli, elli);
+}
+
+
+void warn_atomic_or_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ or_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ or_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ or_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ or_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ or_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ or_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ or_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ or_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ or_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ or_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ or_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ or_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+void nowarn_atomic_xor_fetch (void)
+{
+ _Atomic char *pc = &eac;
+ xor_fetch (pc, ecc);
+
+ _Atomic short *psi = &easi;
+ xor_fetch (psi, esi);
+
+ _Atomic int *pi = &eai;
+ xor_fetch (pi, ei);
+
+ _Atomic long *pli = &eali;
+ xor_fetch (pli, eli);
+
+ _Atomic long long *plli = &ealli;
+ xor_fetch (plli, elli);
+}
+
+
+void warn_atomic_xor_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ xor_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ xor_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 1);
+ xor_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ xor_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ xor_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ xor_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ xor_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ xor_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ xor_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ xor_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&eali + 1);
+ xor_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ xor_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+void nowarn_atomic_nand_fetch (void)
+{
+ _Atomic char *pc = &eac;
+ nand_fetch (pc, ecc);
+
+ _Atomic short *psi = &easi;
+ nand_fetch (psi, esi);
+
+ _Atomic int *pi = &eai;
+ nand_fetch (pi, ei);
+
+ _Atomic long *pli = &eali;
+ nand_fetch (pli, eli);
+
+ _Atomic long long *plli = &ealli;
+ nand_fetch (plli, elli);
+}
+
+
+void warn_atomic_nand_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ nand_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ nand_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 1);
+ nand_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ nand_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ nand_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ nand_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ nand_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ nand_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ nand_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ nand_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&eai + 1);
+ nand_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ nand_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+void nowarn_atomic_exchange (void)
+{
+ char rc;
+ _Atomic char *pc = &eac;
+ exchange (pc, &ecc, &rc);
+
+ short rsi;
+ _Atomic short *psi = &easi;
+ exchange (psi, &esi, &rsi);
+
+ int ri;
+ _Atomic int *pi = &eai;
+ exchange (pi, &ei, &ri);
+
+ long rli;
+ _Atomic long *pli = &eali;
+ exchange (pli, &eli, &rli);
+
+ long long rlli;
+ _Atomic long long *plli = &ealli;
+ exchange (plli, &elli, &rlli);
+
+ sink (&rc, &rsi, &ri, &rli, &rlli);
+}
+
+void warn_atomic_exchange (void)
+{
+ char rc;
+ _Atomic char *pc = &eac + 1;
+ exchange (pc, &ecc, &rc); // { dg-warning "-Wstringop-overflow" }
+
+ short rsi[2];
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ exchange (psi, &ecsi, rsi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ exchange (psi, &ecsi, rsi + 1); // { dg-warning "-Wstringop-overflow" }
+
+ int ri[3];
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ exchange (pi, &eci, ri); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ exchange (pi, &eci, ri + 1); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ exchange (pi, &eci, ri + 2); // { dg-warning "-Wstringop-overflow" }
+
+ long rli[3];
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ exchange (pli, &ecli, rli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ exchange (pli, &ecli, rli + 1); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ exchange (pli, &ecli, rli + 2); // { dg-warning "-Wstringop-overflow" }
+
+ long long rlli[3];
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ exchange (plli, &eclli, rlli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ exchange (plli, &eclli, rlli + 1); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ exchange (plli, &eclli, rlli + 2); // { dg-warning "-Wstringop-overflow" }
+
+ sink (&rc, rsi, ri, rli, rlli);
+}
+
+
+void nowarn_atomic_exchange_n (_Atomic unsigned char *pauc,
+ _Atomic unsigned short *pausi,
+ _Atomic unsigned int *paui,
+ _Atomic unsigned long *pauli,
+ _Atomic unsigned long long *paulli)
+{
+ char rc = exchange_n (&eac, ecc);
+ short rsi = exchange_n (&easi, esi);
+ int ri = exchange_n (&eai, ei);
+ long rli = exchange_n (&eali, eli);
+ long long rlli = exchange_n (&ealli, elli);
+
+ sink (rc, rsi, ri, rli, rlli);
+
+ char ruc = exchange_n (pauc, ecc);
+ short rusi = exchange_n (pausi, esi);
+ int rui = exchange_n (paui, ei);
+ long ruli = exchange_n (pauli, eli);
+ long long rulli = exchange_n (paulli, elli);
+
+ sink (ruc, rusi, rui, ruli, rulli);
+}
+
+
+void warn_atomic_exchange_n (void)
+{
+ _Atomic char *pc = &eac + 1;
+ char rc = exchange_n (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ short rsi[2];
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ rsi[0] = exchange_n (psi, ecsi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ rsi[1] = exchange_n (psi, ecsi); // { dg-warning "-Wstringop-overflow" }
+
+ int ri[3];
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ ri[0] = exchange_n (pi, eci); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ ri[1] = exchange_n (pi, eci); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ ri[2] = exchange_n (pi, eci); // { dg-warning "-Wstringop-overflow" }
+
+ long rli[3];
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ rli[0] = exchange_n (pli, ecli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ rli[1] = exchange_n (pli, ecli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ rli[2] = exchange_n (pli, ecli); // { dg-warning "-Wstringop-overflow" }
+
+ long long rlli[3];
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ rlli[0] = exchange_n (plli, eclli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ rlli[1] = exchange_n (plli, eclli); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ rlli[2] = exchange_n (plli, eclli); // { dg-warning "-Wstringop-overflow" }
+
+ sink (&rc, rsi, ri, rli, rlli);
+}
+
+
+void warn_atomic_compare_exchange (void)
+{
+ _Atomic char *pc = &eac + 1;
+ cmpxchg (pc, &ec, &ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ cmpxchg (psi, &esi, &ecsi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ cmpxchg (psi, &esi, &ecsi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ cmpxchg (pi, &ei, &eci); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ cmpxchg (pi, &ei, &eci); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ cmpxchg (pi, &ei, &eci); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ cmpxchg (pli, &eli, &ecli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ cmpxchg (pli, &eli, &ecli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ cmpxchg (pli, &eli, &ecli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ cmpxchg (plli, &elli, &eclli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ cmpxchg (plli, &elli, &eclli); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ cmpxchg (plli, &elli, &eclli); // { dg-warning "-Wstringop-overflow" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-78.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-78.c
new file mode 100644
index 0000000..a25a418
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-78.c
@@ -0,0 +1,518 @@
+/* PR middle-end/102453 - buffer overflow by atomic built-ins not diagnosed
+ Verify that out-of-bounds accesses by atomic functions are diagnosed with
+ optimization enabled.
+ { dg-do compile }
+ { dg-options "-O3 -Wall -ftrack-macro-expansion=0" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+#define NOIPA __attribute__ ((noipa))
+
+#define add_fetch(p, q) __atomic_add_fetch (p, q, 0)
+#define sub_fetch(p, q) __atomic_sub_fetch (p, q, 0)
+#define and_fetch(p, q) __atomic_and_fetch (p, q, 0)
+#define or_fetch(p, q) __atomic_or_fetch (p, q, 0)
+#define xor_fetch(p, q) __atomic_xor_fetch (p, q, 0)
+#define nand_fetch(p, q) __atomic_nand_fetch (p, q, 0)
+#define exchange(p, q, r) __atomic_exchange (p, q, r, 0)
+#define exchange_n(p, n) __atomic_exchange_n (p, n, 0)
+#define cmpxchg(p, q, r) __atomic_compare_exchange (p, q, r, __COUNTER__, 0, 0)
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*, ...);
+#define sink(...) sink (0, __VA_ARGS__)
+
+extern _Bool eb;
+extern char ec;
+extern short int esi;
+extern int ei;
+extern long int eli;
+extern long long int elli;
+
+extern const _Bool ecb;
+extern const char ecc;
+extern const short int ecsi;
+extern const int eci;
+extern const long int ecli;
+extern const long long int eclli;
+
+extern _Atomic _Bool eab;
+extern _Atomic char eac;
+extern _Atomic short int easi;
+extern _Atomic int eai;
+extern _Atomic long int eali;
+extern _Atomic long long int ealli;
+
+extern _Atomic const _Bool eacb;
+extern _Atomic const char eacc;
+extern _Atomic const short int eacsi;
+extern _Atomic const int eaci;
+extern _Atomic const long int eacli;
+extern _Atomic const long long int eaclli;
+
+
+NOIPA void nowarn_atomic_add_fetch (void)
+{
+ add_fetch (&eac, ecc);
+ add_fetch (&easi, esi);
+ add_fetch (&eai, ei);
+ add_fetch (&eali, eli);
+ add_fetch (&ealli, elli);
+}
+
+
+NOIPA void warn_atomic_add_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ add_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ add_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ add_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ add_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ add_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ add_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ add_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ add_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ add_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ add_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ add_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ add_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+NOIPA void nowarn_atomic_sub_fetch (void)
+{
+ _Atomic char *pc = &eac;
+ sub_fetch (pc, ecc);
+
+ _Atomic short *psi = &easi;
+ sub_fetch (psi, esi);
+
+ _Atomic int *pi = &eai;
+ sub_fetch (pi, ei);
+
+ _Atomic long *pli = &eali;
+ sub_fetch (pli, eli);
+
+ _Atomic long long *plli = &ealli;
+ sub_fetch (plli, elli);
+}
+
+
+NOIPA void warn_atomic_sub_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ sub_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ sub_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ sub_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ sub_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ sub_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ sub_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ sub_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ sub_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ sub_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ sub_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ sub_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ sub_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+NOIPA void nowarn_atomic_and_fetch (void)
+{
+ _Atomic char *pc = &eac;
+ and_fetch (pc, ecc);
+
+ _Atomic short *psi = &easi;
+ and_fetch (psi, esi);
+
+ _Atomic int *pi = &eai;
+ and_fetch (pi, ei);
+
+ _Atomic long *pli = &eali;
+ and_fetch (pli, eli);
+
+ _Atomic long long *plli = &ealli;
+ and_fetch (plli, elli);
+}
+
+
+NOIPA void warn_atomic_and_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ and_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ and_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ and_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ and_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ and_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ and_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ and_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ and_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ and_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ and_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ and_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ and_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+NOIPA void nowarn_atomic_or_fetch (void)
+{
+ _Atomic char *pc = &eac;
+ or_fetch (pc, ecc);
+
+ _Atomic short *psi = &easi;
+ or_fetch (psi, esi);
+
+ _Atomic int *pi = &eai;
+ or_fetch (pi, ei);
+
+ _Atomic long *pli = &eali;
+ or_fetch (pli, eli);
+
+ _Atomic long long *plli = &ealli;
+ or_fetch (plli, elli);
+}
+
+
+NOIPA void warn_atomic_or_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ or_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ or_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ or_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ or_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ or_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ or_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ or_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ or_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ or_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ or_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ or_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ or_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+NOIPA void nowarn_atomic_xor_fetch (void)
+{
+ _Atomic char *pc = &eac;
+ xor_fetch (pc, ecc);
+
+ _Atomic short *psi = &easi;
+ xor_fetch (psi, esi);
+
+ _Atomic int *pi = &eai;
+ xor_fetch (pi, ei);
+
+ _Atomic long *pli = &eali;
+ xor_fetch (pli, eli);
+
+ _Atomic long long *plli = &ealli;
+ xor_fetch (plli, elli);
+}
+
+
+NOIPA void warn_atomic_xor_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ xor_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ xor_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 1);
+ xor_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ xor_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ xor_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ xor_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ xor_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ xor_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ xor_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ xor_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&eali + 1);
+ xor_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ xor_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+NOIPA void nowarn_atomic_nand_fetch (void)
+{
+ _Atomic char *pc = &eac;
+ nand_fetch (pc, ecc);
+
+ _Atomic short *psi = &easi;
+ nand_fetch (psi, esi);
+
+ _Atomic int *pi = &eai;
+ nand_fetch (pi, ei);
+
+ _Atomic long *pli = &eali;
+ nand_fetch (pli, eli);
+
+ _Atomic long long *plli = &ealli;
+ nand_fetch (plli, elli);
+}
+
+
+NOIPA void warn_atomic_nand_fetch (void)
+{
+ _Atomic char *pc = &eac + 1;
+ nand_fetch (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ nand_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 1);
+ nand_fetch (psi, esi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ nand_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ nand_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ nand_fetch (pi, ei); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ nand_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ nand_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ nand_fetch (pli, eli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ nand_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&eai + 1);
+ nand_fetch (plli, eali); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ nand_fetch (plli, elli); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+NOIPA void nowarn_atomic_exchange (void)
+{
+ char rc;
+ _Atomic char *pc = &eac;
+ exchange (pc, &ecc, &rc);
+
+ short rsi;
+ _Atomic short *psi = &easi;
+ exchange (psi, &esi, &rsi);
+
+ int ri;
+ _Atomic int *pi = &eai;
+ exchange (pi, &ei, &ri);
+
+ long rli;
+ _Atomic long *pli = &eali;
+ exchange (pli, &eli, &rli);
+
+ long long rlli;
+ _Atomic long long *plli = &ealli;
+ exchange (plli, &elli, &rlli);
+
+ sink (&rc, &rsi, &ri, &rli, &rlli);
+}
+
+NOIPA void warn_atomic_exchange (void)
+{
+ char rc;
+ _Atomic char *pc = &eac + 1;
+ exchange (pc, &ecc, &rc); // { dg-warning "-Wstringop-overflow" }
+
+ short rsi[2];
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ exchange (psi, &ecsi, rsi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ exchange (psi, &ecsi, rsi + 1); // { dg-warning "-Wstringop-overflow" }
+
+ int ri[3];
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ exchange (pi, &eci, ri); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ exchange (pi, &eci, ri + 1); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ exchange (pi, &eci, ri + 2); // { dg-warning "-Wstringop-overflow" }
+
+ long rli[3];
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ exchange (pli, &ecli, rli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ exchange (pli, &ecli, rli + 1); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ exchange (pli, &ecli, rli + 2); // { dg-warning "-Wstringop-overflow" }
+
+ long long rlli[3];
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ exchange (plli, &eclli, rlli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ exchange (plli, &eclli, rlli + 1); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ exchange (plli, &eclli, rlli + 2); // { dg-warning "-Wstringop-overflow" }
+
+ sink (&rc, rsi, ri, rli, rlli);
+}
+
+
+NOIPA void nowarn_atomic_exchange_n (_Atomic unsigned char *pauc,
+ _Atomic unsigned short *pausi,
+ _Atomic unsigned int *paui,
+ _Atomic unsigned long *pauli,
+ _Atomic unsigned long long *paulli)
+{
+ char rc = exchange_n (&eac, ecc);
+ short rsi = exchange_n (&easi, esi);
+ int ri = exchange_n (&eai, ei);
+ long rli = exchange_n (&eali, eli);
+ long long rlli = exchange_n (&ealli, elli);
+
+ sink (rc, rsi, ri, rli, rlli);
+
+ char ruc = exchange_n (pauc, ecc);
+ short rusi = exchange_n (pausi, esi);
+ int rui = exchange_n (paui, ei);
+ long ruli = exchange_n (pauli, eli);
+ long long rulli = exchange_n (paulli, elli);
+
+ sink (ruc, rusi, rui, ruli, rulli);
+}
+
+
+NOIPA void warn_atomic_exchange_n (void)
+{
+ _Atomic char *pc = &eac + 1;
+ char rc = exchange_n (pc, ecc); // { dg-warning "-Wstringop-overflow" }
+
+ short rsi[2];
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ rsi[0] = exchange_n (psi, ecsi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ rsi[1] = exchange_n (psi, ecsi); // { dg-warning "-Wstringop-overflow" }
+
+ int ri[3];
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ ri[0] = exchange_n (pi, eci); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ ri[1] = exchange_n (pi, eci); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ ri[2] = exchange_n (pi, eci); // { dg-warning "-Wstringop-overflow" }
+
+ long rli[3];
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ rli[0] = exchange_n (pli, ecli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ rli[1] = exchange_n (pli, ecli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ rli[2] = exchange_n (pli, ecli); // { dg-warning "-Wstringop-overflow" }
+
+ long long rlli[3];
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ rlli[0] = exchange_n (plli, eclli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ rlli[1] = exchange_n (plli, eclli); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ rlli[2] = exchange_n (plli, eclli); // { dg-warning "-Wstringop-overflow" }
+
+ sink (&rc, rsi, ri, rli, rlli);
+}
+
+
+NOIPA void warn_atomic_compare_exchange (void)
+{
+ _Atomic char *pc = &eac + 1;
+ cmpxchg (pc, &ec, &ecc); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic short *psi = (_Atomic short*)((char*)&easi + 1);
+ cmpxchg (psi, &esi, &ecsi); // { dg-warning "-Wstringop-overflow" }
+ psi = (_Atomic short*)((char*)&easi + 2);
+ cmpxchg (psi, &esi, &ecsi); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic int *pi = (_Atomic int*)((char*)&eai + 1);
+ cmpxchg (pi, &ei, &eci); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + 2);
+ cmpxchg (pi, &ei, &eci); // { dg-warning "-Wstringop-overflow" }
+ pi = (_Atomic int*)((char*)&eai + sizeof eai);
+ cmpxchg (pi, &ei, &eci); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long *pli = (_Atomic long*)((char*)&eali + 1);
+ cmpxchg (pli, &eli, &ecli); // { dg-warning "-Wstringop-overflow" }
+ pli = (_Atomic long*)((char*)&eali + 1);
+ cmpxchg (pli, &eli, &ecli); // { dg-warning "-Wstringop-overflow" }
+ pli = &eali + 1;
+ cmpxchg (pli, &eli, &ecli); // { dg-warning "-Wstringop-overflow" }
+
+ _Atomic long long *plli = (_Atomic long long*)((char*)&ealli + 1);
+ cmpxchg (plli, &elli, &eclli); // { dg-warning "-Wstringop-overflow" }
+ plli = (_Atomic long long*)((char*)&ealli + 1);
+ cmpxchg (plli, &elli, &eclli); // { dg-warning "-Wstringop-overflow" }
+ plli = &ealli + 1;
+ cmpxchg (plli, &elli, &eclli); // { dg-warning "-Wstringop-overflow" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-79.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-79.c
new file mode 100644
index 0000000..15eb26f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-79.c
@@ -0,0 +1,70 @@
+/* Verify that a separate note is issued for each offset into the same
+ object after a -Wstringop-overflow. Since all arguments are known
+ the test doesn't need optimization. Wstringop-overflow-79.c verifies
+ they're also issued at -O2.
+ { dg-do compile }
+ { dg-options "-O0 -Wno-array-bounds" } */
+
+extern char a[8]; // dg-message at offset \\\[3, 6] into destination object 'a'" "note 1" }
+ // dg-message at offset \\\[5, 8] into destination object 'a'" "note 2" { target *-*-* } .-1 }
+
+void test_2_notes (int i)
+{
+ char *p = i ? a + 3 : a + 5;
+ __builtin_memset (p, 0, 7); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+extern char b[8]; // dg-message at offset \\\[3, 6] into destination object 'b'" "note 1" }
+ // dg-message at offset \\\[4, 7] into destination object 'b'" "note 2" { target *-*-* } .-1 }
+ // dg-message at offset \\\[5, 8] into destination object 'b'" "note 3" { target *-*-* } .-2 }
+
+void test_3_notes (int i)
+{
+ char *p = i < 0 ? b + 3 : 0 < i ? b + 5 : b + 4;
+ __builtin_memset (p, 0, 7); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+extern char c[8]; // dg-message at offset \\\[3, 6] into destination object 'c'" "note 1" }
+ // dg-message at offset \\\[4, 7] into destination object 'c'" "note 2" { target *-*-* } .-1 }
+ // dg-message at offset \\\[5, 8] into destination object 'c'" "note 3" { target *-*-* } .-2 }
+ // dg-message at offset \\\[6, 8] into destination object 'c'" "note 3" { target *-*-* } .-2 }
+
+void test_4_notes (int i)
+{
+ char *p;
+ if (i < -1)
+ p = c + 3;
+ else if (i < 0)
+ p = c + 4;
+ else if (0 < i)
+ p = c + 6;
+ else
+ p = c + 5;
+
+ __builtin_memset (p, 0, 7); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+extern char d[8]; // dg-message at offset \\\[3, 6] into destination object 'd'" "note 1" }
+ // dg-message at offset \\\[4, 7] into destination object 'd'" "note 2" { target *-*-* } .-1 }
+ // dg-message at offset \\\[5, 8] into destination object 'd'" "note 3" { target *-*-* } .-2 }
+ // dg-message at offset \\\[6, 8] into destination object 'd'" "note 3" { target *-*-* } .-3 }
+ // dg-message at offset \\\[7, 8] into destination object 'd'" "note 3" { target *-*-* } .-4 }
+
+void test_5_notes (int i)
+{
+ char *p;
+ switch (i)
+ {
+ case -9: p = d + 3; break;
+ case -5: p = d + 4; break;
+ case 0: p = d + 5; break;
+ case 3: p = d + 6; break;
+ case 4: p = d + 7; break;
+ default: return;
+ }
+
+ __builtin_memset (p, 0, 7); // { dg-warning "-Wstringop-overflow" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-80.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-80.c
new file mode 100644
index 0000000..1628c2f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-80.c
@@ -0,0 +1,70 @@
+/* Verify that a separate note is issued for each offset into the same
+ object after a -Wstringop-overflow. Even though the warnings don't
+ need optimization the test enables it to verify they're still issued
+ with it. Wstringop-overflow-78.c verifies they're issued at -O0.
+ { dg-do compile }
+ { dg-options "-O2 -Wno-array-bounds" } */
+
+extern char a[8]; // dg-message at offset \\\[3, 6] into destination object 'a'" "note 1" }
+ // dg-message at offset \\\[5, 8] into destination object 'a'" "note 2" { target *-*-* } .-1 }
+
+void test_2_notes (int i)
+{
+ char *p = i ? a + 3 : a + 5;
+ __builtin_memset (p, 0, 7); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+extern char b[8]; // dg-message at offset \\\[3, 6] into destination object 'b'" "note 1" }
+ // dg-message at offset \\\[4, 7] into destination object 'b'" "note 2" { target *-*-* } .-1 }
+ // dg-message at offset \\\[5, 8] into destination object 'b'" "note 3" { target *-*-* } .-2 }
+
+void test_3_notes (int i)
+{
+ char *p = i < 0 ? b + 3 : 0 < i ? b + 5 : b + 4;
+ __builtin_memset (p, 0, 7); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+extern char c[8]; // dg-message at offset \\\[3, 6] into destination object 'c'" "note 1" }
+ // dg-message at offset \\\[4, 7] into destination object 'c'" "note 2" { target *-*-* } .-1 }
+ // dg-message at offset \\\[5, 8] into destination object 'c'" "note 3" { target *-*-* } .-2 }
+ // dg-message at offset \\\[6, 8] into destination object 'c'" "note 3" { target *-*-* } .-2 }
+
+void test_4_notes (int i)
+{
+ char *p;
+ if (i < -1)
+ p = c + 3;
+ else if (i < 0)
+ p = c + 4;
+ else if (0 < i)
+ p = c + 6;
+ else
+ p = c + 5;
+
+ __builtin_memset (p, 0, 7); // { dg-warning "-Wstringop-overflow" }
+}
+
+
+extern char d[8]; // dg-message at offset \\\[3, 6] into destination object 'd'" "note 1" }
+ // dg-message at offset \\\[4, 7] into destination object 'd'" "note 2" { target *-*-* } .-1 }
+ // dg-message at offset \\\[5, 8] into destination object 'd'" "note 3" { target *-*-* } .-2 }
+ // dg-message at offset \\\[6, 8] into destination object 'd'" "note 3" { target *-*-* } .-3 }
+ // dg-message at offset \\\[7, 8] into destination object 'd'" "note 3" { target *-*-* } .-4 }
+
+void test_5_notes (int i)
+{
+ char *p;
+ switch (i)
+ {
+ case -9: p = d + 3; break;
+ case -5: p = d + 4; break;
+ case 0: p = d + 5; break;
+ case 3: p = d + 6; break;
+ case 4: p = d + 7; break;
+ default: return;
+ }
+
+ __builtin_memset (p, 0, 7); // { dg-warning "-Wstringop-overflow" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-81.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-81.c
new file mode 100644
index 0000000..e8bc327
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-81.c
@@ -0,0 +1,38 @@
+/* Verify that -Wstringop-overflow uses context-sensitive range info
+ even at -O0.
+ { dg-do compile }
+ { dg-options "-O0 -Wall" } */
+
+extern void* memset (void*, int, __SIZE_TYPE__);
+
+char a[8];
+
+void warn_offset_range (int i)
+{
+ if (i < 4)
+ i = 4;
+ memset (a + i, 0, 5); // { dg-warning "writing 5 bytes into a region of size 4 " }
+}
+
+void warn_size_range (int i, int n)
+{
+ if (n < 5)
+ n = 5;
+
+ memset (a + 4, 1, n); // { dg-warning "writing between 5 and \\d+ bytes into a region of size 4 " }
+}
+
+void warn_offset_and_size_range (int i, int n)
+{
+ if (n < 5)
+ n = 5;
+
+ if (i < 4)
+ {
+ if (n < 9)
+ n = 9;
+ memset (a + i, 1, n); // { dg-warning "writing between 9 and \\d+ bytes into a region of size 8 " }
+ }
+ else
+ memset (a + i, 0, n); // { dg-warning "writing between 5 and \\d+ bytes into a region of size 4 " }
+}
diff --git a/gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2-novec.c b/gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2-novec.c
new file mode 100644
index 0000000..8e023b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2-novec.c
@@ -0,0 +1,45 @@
+/* Test to verify that -Wzero-length-bounds and not -Warray-bounds is
+ issued for accesses to interior zero-length array members that are
+ within the bounds of the enclosing struct.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -fno-tree-vectorize" } */
+
+void sink (void*);
+
+struct A { int i; };
+struct B { int j; struct A a[0]; };
+
+struct C
+{
+ struct B b1;
+ struct B b2;
+};
+
+char cbuf1[1 * sizeof (struct C)];
+char cbuf2[2 * sizeof (struct C)] = { };
+
+void test_C_global_buf (void)
+{
+ struct C *p = (struct C*)&cbuf1;
+
+ p->b1.a[-1].i = 0; // { dg-warning "\\\[-Warray-bounds" }
+ p->b1.a[ 0].i = 0; // { dg-warning "\\\[-Wzero-length-bounds" }
+ p->b1.a[ 1].i = 0; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p);
+
+ p->b2.a[ 0].i = 0; // { dg-warning "\\\[-Warray-bounds" }
+ p->b2.a[ 1].i = 0; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p);
+
+ p = (struct C*)&cbuf2;
+ p->b1.a[-1].i = 0; // { dg-warning "\\\[-Warray-bounds" }
+ p->b1.a[ 0].i = 0; // { dg-warning "\\\[-Wzero-length-bounds" }
+ p->b1.a[ 1].i = 0; // { dg-warning "\\\[-Wzero-length-bounds" }
+ sink (p);
+
+ p->b2.a[ 0].i = 0;
+ p->b2.a[ 1].i = 0;
+ p->b2.a[ 2].i = 0; // { dg-warning "\\\[-Warray-bounds" }
+ p->b2.a[ 3].i = 0; // { dg-warning "\\\[-Warray-bounds" }
+ sink (p);
+}
diff --git a/gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2.c b/gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2.c
index 841b2bf..b232149 100644
--- a/gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2.c
+++ b/gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2.c
@@ -87,7 +87,7 @@ void test_C_global_buf (void)
p->b1.a[ 1].i = 0; // { dg-warning "\\\[-Wzero-length-bounds" }
sink (p);
- p->b2.a[ 0].i = 0;
+ p->b2.a[ 0].i = 0; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v2si_store && { ! vect_slp_v4si_store } } } }
p->b2.a[ 1].i = 0;
p->b2.a[ 2].i = 0; // { dg-warning "\\\[-Warray-bounds" }
p->b2.a[ 3].i = 0; // { dg-warning "\\\[-Warray-bounds" }
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c b/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c
index 0acf488..62176bd 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c
@@ -45,7 +45,7 @@ int pamark(void) {
if (curbp->b_amark == (AMARK *)NULL)
curbp->b_amark = p;
else
- last->m_next = p; /* { dg-warning "dereference of NULL 'last'" "deref" { xfail *-*-* } } */
+ last->m_next = p; /* { dg-warning "dereference of NULL 'last'" "deref" } */
}
p->m_name = (char)c; /* { dg-bogus "leak of 'p'" "bogus leak" } */
diff --git a/gcc/testsuite/gcc.dg/format/c11-dfp-printf-1.c b/gcc/testsuite/gcc.dg/format/c11-dfp-printf-1.c
new file mode 100644
index 0000000..356a23e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/c11-dfp-printf-1.c
@@ -0,0 +1,35 @@
+/* Test for printf formats: rejection of DFP formats in pedantic mode. */
+/* { dg-do compile } */
+/* { dg-require-effective-target dfp } */
+/* { dg-options "-std=gnu11 -pedantic -Wformat" } */
+
+#include "format.h"
+
+void
+foo (_Decimal32 d32, _Decimal64 d64, _Decimal128 d128) /* { dg-warning "ISO C" } */
+{
+ printf ("%Ha", d32); /* { dg-warning "C" } */
+ printf ("%HA", d32); /* { dg-warning "C" } */
+ printf ("%He", d32); /* { dg-warning "C" } */
+ printf ("%HE", d32); /* { dg-warning "C" } */
+ printf ("%Hf", d32); /* { dg-warning "C" } */
+ printf ("%HF", d32); /* { dg-warning "C" } */
+ printf ("%Hg", d32); /* { dg-warning "C" } */
+ printf ("%HG", d32); /* { dg-warning "C" } */
+ printf ("%Da", d64); /* { dg-warning "C" } */
+ printf ("%DA", d64); /* { dg-warning "C" } */
+ printf ("%De", d64); /* { dg-warning "C" } */
+ printf ("%DE", d64); /* { dg-warning "C" } */
+ printf ("%Df", d64); /* { dg-warning "C" } */
+ printf ("%DF", d64); /* { dg-warning "C" } */
+ printf ("%Dg", d64); /* { dg-warning "C" } */
+ printf ("%DG", d64); /* { dg-warning "C" } */
+ printf ("%DDa", d128); /* { dg-warning "C" } */
+ printf ("%DDA", d128); /* { dg-warning "C" } */
+ printf ("%DDe", d128); /* { dg-warning "C" } */
+ printf ("%DDE", d128); /* { dg-warning "C" } */
+ printf ("%DDf", d128); /* { dg-warning "C" } */
+ printf ("%DDF", d128); /* { dg-warning "C" } */
+ printf ("%DDg", d128); /* { dg-warning "C" } */
+ printf ("%DDG", d128); /* { dg-warning "C" } */
+}
diff --git a/gcc/testsuite/gcc.dg/format/c11-dfp-scanf-1.c b/gcc/testsuite/gcc.dg/format/c11-dfp-scanf-1.c
new file mode 100644
index 0000000..35bd631
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/c11-dfp-scanf-1.c
@@ -0,0 +1,35 @@
+/* Test for scanf formats: rejection of DFP formats in pedantic mode. */
+/* { dg-do compile } */
+/* { dg-require-effective-target dfp } */
+/* { dg-options "-std=gnu11 -pedantic -Wformat" } */
+
+#include "format.h"
+
+void
+foo (_Decimal32 *d32, _Decimal64 *d64, _Decimal128 *d128) /* { dg-warning "ISO C" } */
+{
+ scanf ("%Ha", d32); /* { dg-warning "C" } */
+ scanf ("%HA", d32); /* { dg-warning "C" } */
+ scanf ("%He", d32); /* { dg-warning "C" } */
+ scanf ("%HE", d32); /* { dg-warning "C" } */
+ scanf ("%Hf", d32); /* { dg-warning "C" } */
+ scanf ("%HF", d32); /* { dg-warning "C" } */
+ scanf ("%Hg", d32); /* { dg-warning "C" } */
+ scanf ("%HG", d32); /* { dg-warning "C" } */
+ scanf ("%Da", d64); /* { dg-warning "C" } */
+ scanf ("%DA", d64); /* { dg-warning "C" } */
+ scanf ("%De", d64); /* { dg-warning "C" } */
+ scanf ("%DE", d64); /* { dg-warning "C" } */
+ scanf ("%Df", d64); /* { dg-warning "C" } */
+ scanf ("%DF", d64); /* { dg-warning "C" } */
+ scanf ("%Dg", d64); /* { dg-warning "C" } */
+ scanf ("%DG", d64); /* { dg-warning "C" } */
+ scanf ("%DDa", d128); /* { dg-warning "C" } */
+ scanf ("%DDA", d128); /* { dg-warning "C" } */
+ scanf ("%DDe", d128); /* { dg-warning "C" } */
+ scanf ("%DDE", d128); /* { dg-warning "C" } */
+ scanf ("%DDf", d128); /* { dg-warning "C" } */
+ scanf ("%DDF", d128); /* { dg-warning "C" } */
+ scanf ("%DDg", d128); /* { dg-warning "C" } */
+ scanf ("%DDG", d128); /* { dg-warning "C" } */
+}
diff --git a/gcc/testsuite/gcc.dg/format/c11-printf-1.c b/gcc/testsuite/gcc.dg/format/c11-printf-1.c
new file mode 100644
index 0000000..7b8a992
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/c11-printf-1.c
@@ -0,0 +1,13 @@
+/* Test for printf formats: rejection of C2X (and C2X-recommended) formats in
+ pedantic mode. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic -Wformat" } */
+
+#include "format.h"
+
+void
+foo (int i)
+{
+ printf ("%b", i); /* { dg-warning "C" } */
+ printf ("%B", i); /* { dg-warning "C" } */
+}
diff --git a/gcc/testsuite/gcc.dg/format/c11-scanf-1.c b/gcc/testsuite/gcc.dg/format/c11-scanf-1.c
new file mode 100644
index 0000000..d2b9bfb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/c11-scanf-1.c
@@ -0,0 +1,11 @@
+/* Test for printf formats: rejection of C2X formats in pedantic mode. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic -Wformat" } */
+
+#include "format.h"
+
+void
+foo (unsigned int *uip)
+{
+ scanf ("%b", uip); /* { dg-warning "C" } */
+}
diff --git a/gcc/testsuite/gcc.dg/format/c2x-dfp-printf-1.c b/gcc/testsuite/gcc.dg/format/c2x-dfp-printf-1.c
new file mode 100644
index 0000000..dc40f99
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/c2x-dfp-printf-1.c
@@ -0,0 +1,35 @@
+/* Test for printf formats: acceptance of DFP formats in pedantic mode. */
+/* { dg-do compile } */
+/* { dg-require-effective-target dfp } */
+/* { dg-options "-std=c2x -pedantic -Wformat" } */
+
+#include "format.h"
+
+void
+foo (_Decimal32 d32, _Decimal64 d64, _Decimal128 d128)
+{
+ printf ("%Ha", d32);
+ printf ("%HA", d32);
+ printf ("%He", d32);
+ printf ("%HE", d32);
+ printf ("%Hf", d32);
+ printf ("%HF", d32);
+ printf ("%Hg", d32);
+ printf ("%HG", d32);
+ printf ("%Da", d64);
+ printf ("%DA", d64);
+ printf ("%De", d64);
+ printf ("%DE", d64);
+ printf ("%Df", d64);
+ printf ("%DF", d64);
+ printf ("%Dg", d64);
+ printf ("%DG", d64);
+ printf ("%DDa", d128);
+ printf ("%DDA", d128);
+ printf ("%DDe", d128);
+ printf ("%DDE", d128);
+ printf ("%DDf", d128);
+ printf ("%DDF", d128);
+ printf ("%DDg", d128);
+ printf ("%DDG", d128);
+}
diff --git a/gcc/testsuite/gcc.dg/format/c2x-dfp-scanf-1.c b/gcc/testsuite/gcc.dg/format/c2x-dfp-scanf-1.c
new file mode 100644
index 0000000..81e39a9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/c2x-dfp-scanf-1.c
@@ -0,0 +1,35 @@
+/* Test for scanf formats: acceptance of DFP formats in pedantic mode. */
+/* { dg-do compile } */
+/* { dg-require-effective-target dfp } */
+/* { dg-options "-std=c2x -pedantic -Wformat" } */
+
+#include "format.h"
+
+void
+foo (_Decimal32 *d32, _Decimal64 *d64, _Decimal128 *d128)
+{
+ scanf ("%Ha", d32);
+ scanf ("%HA", d32);
+ scanf ("%He", d32);
+ scanf ("%HE", d32);
+ scanf ("%Hf", d32);
+ scanf ("%HF", d32);
+ scanf ("%Hg", d32);
+ scanf ("%HG", d32);
+ scanf ("%Da", d64);
+ scanf ("%DA", d64);
+ scanf ("%De", d64);
+ scanf ("%DE", d64);
+ scanf ("%Df", d64);
+ scanf ("%DF", d64);
+ scanf ("%Dg", d64);
+ scanf ("%DG", d64);
+ scanf ("%DDa", d128);
+ scanf ("%DDA", d128);
+ scanf ("%DDe", d128);
+ scanf ("%DDE", d128);
+ scanf ("%DDf", d128);
+ scanf ("%DDF", d128);
+ scanf ("%DDg", d128);
+ scanf ("%DDG", d128);
+}
diff --git a/gcc/testsuite/gcc.dg/format/c2x-printf-1.c b/gcc/testsuite/gcc.dg/format/c2x-printf-1.c
new file mode 100644
index 0000000..3ae7713
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/c2x-printf-1.c
@@ -0,0 +1,26 @@
+/* Test for printf formats. Formats using C2X features. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic -Wformat" } */
+
+#include "format.h"
+
+void
+foo (unsigned int u, unsigned short us, unsigned char uc, unsigned long ul,
+ unsigned long long ull, uintmax_t uj, size_t z, unsigned_ptrdiff_t ut)
+{
+ /* Use of %b with each length modifier and other valid features. */
+ printf ("%b %hb %hhb %lb %llb %jb %zb %tb\n", u, us, uc, ul, ull, uj, z, ut);
+ printf ("%*.*llb\n", 1, 2, ull);
+ printf ("%-b\n", u);
+ printf ("%#b\n", u);
+ printf ("%08b\n", u);
+ /* Flags valid on signed conversions only. */
+ printf ("%+b\n", u); /* { dg-warning "flag" } */
+ printf ("% b\n", u); /* { dg-warning "flag" } */
+ /* Flags ignored in certain combinations. */
+ printf ("%-08b\n", u); /* { dg-warning "ignored" } */
+ printf ("%08.5b\n", u); /* { dg-warning "ignored" } */
+ /* Use of 'L' and 'q' for long long is an extension. */
+ printf ("%Lb", ull); /* { dg-warning "does not support" } */
+ printf ("%qb", ull); /* { dg-warning "does not support" } */
+}
diff --git a/gcc/testsuite/gcc.dg/format/c2x-scanf-1.c b/gcc/testsuite/gcc.dg/format/c2x-scanf-1.c
new file mode 100644
index 0000000..f46a715
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/c2x-scanf-1.c
@@ -0,0 +1,17 @@
+/* Test for scanf formats. Formats using C2X features. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic -Wformat" } */
+
+#include "format.h"
+
+void
+foo (unsigned int *uip, unsigned short int *uhp, unsigned char *uhhp,
+ unsigned long int *ulp, unsigned long long *ullp, uintmax_t *ujp,
+ size_t *zp, unsigned_ptrdiff_t *utp)
+{
+ scanf ("%*b");
+ scanf ("%2b", uip);
+ scanf ("%hb%hhb%lb%llb%jb%zb%tb", uhp, uhhp, ulp, ullp, ujp, zp, utp);
+ scanf ("%Lb", ullp); /* { dg-warning "does not support" } */
+ scanf ("%qb", ullp); /* { dg-warning "does not support" } */
+}
diff --git a/gcc/testsuite/gcc.dg/format/ext-10.c b/gcc/testsuite/gcc.dg/format/ext-10.c
new file mode 100644
index 0000000..370ea86
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/ext-10.c
@@ -0,0 +1,13 @@
+/* Test for scanf format extensions using formats from C2X. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu2x -Wformat" } */
+
+#include "format.h"
+
+void
+foo (u_quad_t *uqp, unsigned long long int *ullp)
+{
+ /* Deprecated length modifiers with %b. */
+ scanf ("%qb", uqp);
+ scanf ("%Lb", ullp);
+}
diff --git a/gcc/testsuite/gcc.dg/format/ext-9.c b/gcc/testsuite/gcc.dg/format/ext-9.c
new file mode 100644
index 0000000..15f59e2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/ext-9.c
@@ -0,0 +1,29 @@
+/* Test for printf format extensions using formats from or recommended by
+ C2X. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu2x -Wformat" } */
+
+#include "format.h"
+
+void
+foo (u_quad_t uq, unsigned int u, unsigned short us, unsigned char uc,
+ unsigned long ul, unsigned long long ull, uintmax_t uj, size_t z,
+ unsigned_ptrdiff_t ut)
+{
+ /* Deprecated length modifiers with %b and %B. */
+ printf ("%qb%qB", uq, uq);
+ printf ("%Lb%LB", ull, ull);
+ printf ("%Zb%ZB", z, z);
+ /* Use of %B in cases valid for %b. */
+ printf ("%B %hB %hhB %lB %llB %jB %zB %tB\n", u, us, uc, ul, ull, uj, z, ut);
+ printf ("%*.*llB\n", 1, 2, ull);
+ printf ("%-B\n", u);
+ printf ("%#B\n", u);
+ printf ("%08B\n", u);
+ /* Flags valid on signed conversions only. */
+ printf ("%+B\n", u); /* { dg-warning "flag" } */
+ printf ("% B\n", u); /* { dg-warning "flag" } */
+ /* Flags ignored in certain combinations. */
+ printf ("%-08B\n", u); /* { dg-warning "ignored" } */
+ printf ("%08.5B\n", u); /* { dg-warning "ignored" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gimplefe-error-12.c b/gcc/testsuite/gcc.dg/gimplefe-error-12.c
new file mode 100644
index 0000000..981ff7b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gimplefe-error-12.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple" } */
+
+int get_current ();
+
+__GIMPLE
+void foo()
+{
+ get_current()->flags; /* { dg-error "non-pointer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/sections-2.c b/gcc/testsuite/gcc.dg/gomp/sections-2.c
index aabdfaf..6d8305a 100644
--- a/gcc/testsuite/gcc.dg/gomp/sections-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/sections-2.c
@@ -19,11 +19,11 @@ void foo(void)
{
#pragma omp section
bar(2);
- bar(3); // { dg-error "expected" }
+ bar(3);
bar(4);
#pragma omp section
bar(5);
- bar(6); // { dg-error "expected" }
+ bar(6);
bar(7);
}
}
diff --git a/gcc/testsuite/gcc.dg/gomp/simd-2.c b/gcc/testsuite/gcc.dg/gomp/simd-2.c
index f491212..85acb98 100644
--- a/gcc/testsuite/gcc.dg/gomp/simd-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/simd-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */
/* { dg-additional-options "-mavx" { target avx } } */
/* { dg-final { scan-tree-dump-times "vectorized \[1-9]\[0-9]* loops in function" 5 "vect" { target i?86-*-* x86_64-*-* aarch64-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/simd-3.c b/gcc/testsuite/gcc.dg/gomp/simd-3.c
index c75060c..86fee85 100644
--- a/gcc/testsuite/gcc.dg/gomp/simd-3.c
+++ b/gcc/testsuite/gcc.dg/gomp/simd-3.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-vect-details" } */
/* { dg-additional-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */
/* { dg-additional-options "-mavx" { target avx } } */
/* { dg-final { scan-tree-dump-times "vectorized \[1-9]\[0-9]* loops in function" 5 "vect" { target i?86-*-* x86_64-*-* aarch64-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/pr69728.c b/gcc/testsuite/gcc.dg/graphite/pr69728.c
index 69e2831..a6f3857 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr69728.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr69728.c
@@ -24,6 +24,4 @@ fn1 ()
run into scheduling issues before here, not being able to handle
empty domains. */
-/* XFAILed by fix for PR86865. */
-
-/* { dg-final { scan-tree-dump "loop nest optimized" "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "loop nest optimized" "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-dsyr2k-2.c b/gcc/testsuite/gcc.dg/graphite/scop-dsyr2k-2.c
index 06aa19a..42e23fc 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-dsyr2k-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-dsyr2k-2.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target size32plus } */
+/* { dg-additional-options "-fno-thread-jumps" } */
#define NMAX 3000
static double a[NMAX][NMAX], b[NMAX][NMAX], c[NMAX][NMAX];
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-dsyr2k.c b/gcc/testsuite/gcc.dg/graphite/scop-dsyr2k.c
index 925ae30..feb9935 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-dsyr2k.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-dsyr2k.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target size32plus } */
+/* { dg-additional-options "-fno-thread-jumps" } */
#define NMAX 3000
static double a[NMAX][NMAX], b[NMAX][NMAX], c[NMAX][NMAX];
@@ -17,4 +18,4 @@ void dsyr2k(int N) {
#pragma endscop
}
-/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-dsyrk-2.c b/gcc/testsuite/gcc.dg/graphite/scop-dsyrk-2.c
index 5622dce..935ade3 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-dsyrk-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-dsyrk-2.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target size32plus } */
+/* { dg-additional-options "-fno-thread-jumps" } */
#define NMAX 3000
#define MEASURE_TIME 1
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-dsyrk.c b/gcc/testsuite/gcc.dg/graphite/scop-dsyrk.c
index b748946..5c65e40 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-dsyrk.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-dsyrk.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target size32plus } */
+/* { dg-additional-options "-fno-thread-jumps" } */
#define NMAX 3000
#define MEASURE_TIME 1
@@ -19,4 +20,4 @@ void dsyrk(int N)
#pragma endscop
}
-/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/pr102714.c b/gcc/testsuite/gcc.dg/ipa/pr102714.c
new file mode 100644
index 0000000..65dd86f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr102714.c
@@ -0,0 +1,117 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-strict-aliasing -fdump-ipa-sra-details -fdump-tree-optimized" } */
+
+typedef _Bool bool;
+
+enum {
+ false = 0,
+ true = 1
+};
+
+struct xarray {
+ unsigned int xa_lock;
+ unsigned int xa_flags;
+ void * xa_head;
+
+};
+
+struct list_head {
+ struct list_head *next, *prev;
+};
+
+struct callback_head {
+ struct callback_head *next;
+ void (*func)(struct callback_head *head);
+} __attribute__((aligned(sizeof(void *))));
+
+struct xa_node {
+ unsigned char shift;
+ unsigned char offset;
+ unsigned char count;
+ unsigned char nr_values;
+ struct xa_node *parent;
+ struct xarray *array;
+ union {
+ struct list_head private_list;
+ struct callback_head callback_head;
+ };
+ void *slots[(1UL << (0 ? 4 : 6))];
+ union {
+ unsigned long tags[3][((((1UL << (0 ? 4 : 6))) + (64) - 1) / (64))];
+ unsigned long marks[3][((((1UL << (0 ? 4 : 6))) + (64) - 1) / (64))];
+ };
+};
+
+static inline __attribute__((__gnu_inline__)) __attribute__((__unused__)) __attribute__((no_instrument_function)) unsigned long shift_maxindex(unsigned int shift)
+{
+ return ((1UL << (0 ? 4 : 6)) << shift) - 1;
+}
+
+static inline __attribute__((__gnu_inline__)) __attribute__((__unused__)) __attribute__((no_instrument_function)) unsigned long node_maxindex(const struct xa_node *node)
+{
+ return shift_maxindex(node->shift);
+}
+
+static inline __attribute__((__gnu_inline__)) __attribute__((__unused__)) __attribute__((no_instrument_function)) struct xa_node *entry_to_node(void *ptr)
+{
+ return (void *)((unsigned long)ptr & ~2UL);
+}
+
+static inline __attribute__((__gnu_inline__)) __attribute__((__unused__)) __attribute__((no_instrument_function)) bool radix_tree_is_internal_node(void *ptr)
+{
+ return ((unsigned long)ptr & 3UL) ==
+ 2UL;
+}
+
+static inline __attribute__((__gnu_inline__)) __attribute__((__unused__)) __attribute__((no_instrument_function)) void *xa_mk_internal(unsigned long v)
+{
+ return (void *)((v << 2) | 2);
+}
+
+static unsigned radix_tree_load_root(const struct xarray *root,
+ struct xa_node **nodep, unsigned long *maxindex)
+{
+ struct xa_node *node =
+ ({
+ typeof(root->xa_head) ________p1 = ({(*(const volatile typeof(root->xa_head) *)&(root->xa_head)); });
+ ((typeof(*root->xa_head) *)(________p1));
+ });
+
+ *nodep = node;
+
+ if (__builtin_expect(!!(radix_tree_is_internal_node(node)), 1)) {
+ node = entry_to_node(node);
+ *maxindex = node_maxindex(node);
+ return node->shift + (0 ? 4 : 6);
+ }
+
+ *maxindex = 0;
+ return 0;
+}
+
+void *__radix_tree_lookup(const struct xarray *root,
+ unsigned long index, struct xa_node **nodep,
+ void ***slotp)
+{
+ struct xa_node *node, *parent;
+ unsigned long maxindex;
+
+ restart:
+ parent = ((void *)0);
+ radix_tree_load_root(root, &node, &maxindex);
+ while (radix_tree_is_internal_node(node)) {
+
+ parent = entry_to_node(node);
+ if (node == xa_mk_internal(256))
+ goto restart;
+ if (parent->shift == 0)
+ break;
+ }
+ if (nodep)
+ *nodep = parent;
+
+ return node;
+}
+
+/* { dg-final { scan-ipa-dump-not "IPA_PARAM_OP_SPLIT" "sra" } } */
+/* { dg-final { scan-tree-dump " ={v} " "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/loop-8.c b/gcc/testsuite/gcc.dg/loop-8.c
index 90ea1c4..a685fc2 100644
--- a/gcc/testsuite/gcc.dg/loop-8.c
+++ b/gcc/testsuite/gcc.dg/loop-8.c
@@ -11,18 +11,23 @@ f (int *a, int *b)
{
int i;
- for (i = 0; i < 100; i++)
+ i = 100;
+ if (i > 0)
{
- int d = 42;
+ do
+ {
+ int d = 42;
- a[i] = d;
- if (i % 2)
- d = i;
- b[i] = d;
+ a[i] = d;
+ if (i % 2)
+ d = i;
+ b[i] = d;
+ ++i;
+ }
+ while (i < 100);
}
}
/* Load of 42 is moved out of the loop, introducing a new pseudo register. */
-/* { dg-final { scan-rtl-dump-times "Decided" 1 "loop2_invariant" } } */
/* { dg-final { scan-rtl-dump-not "without introducing a new temporary register" "loop2_invariant" } } */
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c
index 91a5284..5934aac 100644
--- a/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c
+++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-5.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target bswap } */
-/* { dg-options "-O2 -fdump-tree-optimized -fno-inline-functions" } */
+/* { dg-options "-O2 -fno-tree-vectorize -fdump-tree-optimized -fno-inline-functions" } */
/* { dg-additional-options "-march=z900" { target s390-*-* } } */
struct L { unsigned int l[2]; };
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c
index 3c089b3..75f8aec 100644
--- a/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c
+++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-6.c
@@ -1,7 +1,7 @@
/* PR tree-optimization/42587 */
/* { dg-do compile } */
/* { dg-require-effective-target bswap } */
-/* { dg-options "-O2 -fdump-tree-store-merging" } */
+/* { dg-options "-O2 -fno-tree-vectorize -fdump-tree-store-merging" } */
/* { dg-additional-options "-march=z900" { target s390-*-* } } */
typedef unsigned char u8;
diff --git a/gcc/testsuite/gcc.dg/plugin/gil-1.c b/gcc/testsuite/gcc.dg/plugin/gil-1.c
index 66872f0..6cbc197 100644
--- a/gcc/testsuite/gcc.dg/plugin/gil-1.c
+++ b/gcc/testsuite/gcc.dg/plugin/gil-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-fanalyzer" } */
+/* { dg-require-effective-target analyzer } */
#include "gil.h"
diff --git a/gcc/testsuite/gcc.dg/pr102385.c b/gcc/testsuite/gcc.dg/pr102385.c
new file mode 100644
index 0000000..1339540
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102385.c
@@ -0,0 +1,14 @@
+/* { dg-options "-Wall -Wextra -O2 -fno-toplevel-reorder -fno-tree-ch -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-tree-loop-ivcanon -fpredictive-commoning" } */
+
+short a, b;
+int c[9];
+void(d)() {}
+void e() {
+ a = 0;
+ for (; a <= 4; a++) {
+ short *f = &b;
+ c[a] || (*f = 0);
+ d(c[a + 2]);
+ }
+}
+int main() {return 0;}
diff --git a/gcc/testsuite/gcc.dg/pr102585.c b/gcc/testsuite/gcc.dg/pr102585.c
new file mode 100644
index 0000000..efd066b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102585.c
@@ -0,0 +1,6 @@
+/* PR debug/102585 */
+/* { dg-do compile } */
+/* { dg-options "-fvar-tracking-assignments -fno-var-tracking" } */
+
+#pragma GCC optimize 0
+void d_demangle_callback_Og() { int c = 0; }
diff --git a/gcc/testsuite/gcc.dg/pr102738.c b/gcc/testsuite/gcc.dg/pr102738.c
new file mode 100644
index 0000000..cd58c25
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102738.c
@@ -0,0 +1,49 @@
+/* PR tree-optimization/102738 */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+/* { dg-do compile { target int128 } } */
+
+/* Remove arithmetic shift right when the LHS is known to be 0 or -1. */
+
+int a1(__int128 f, int g)
+{
+ /* Leaves f >> 127. */
+ return (f >> 127) >> g;
+}
+
+int a2(int f, int g)
+{
+ /* Leaves f >> 31. */
+ return (f >> 31) >> g;
+}
+
+int a3(int f, int g)
+{
+ if (f == 0 || f == -1)
+ return f >> g;
+ __builtin_unreachable();
+}
+
+int a4(int f, int g)
+{
+ if (f == 0 || f == 1)
+ return (-f) >> g;
+ __builtin_unreachable();
+}
+
+int a5(int f, int g)
+{
+ if (f == 0 || f == 1)
+ return (f-1) >> g;
+ return 0;
+}
+
+int a6(int f, int g)
+{
+ if (f == 6 || f == 7)
+ return (f-7) >> g;
+ __builtin_unreachable();
+}
+
+/* { dg-final { scan-tree-dump-times " >> 127" 1 "evrp" } } */
+/* { dg-final { scan-tree-dump-times " >> 31" 1 "evrp" } } */
+/* { dg-final { scan-tree-dump-times " >> " 2 "evrp" } } */
diff --git a/gcc/testsuite/gcc.dg/pr102764.c b/gcc/testsuite/gcc.dg/pr102764.c
new file mode 100644
index 0000000..ea1c634
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102764.c
@@ -0,0 +1,14 @@
+/* PR middle-end/102764 */
+/* Reported by Chengnian Sun <cnsun@uwaterloo.ca> */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcompare-debug" } */
+
+volatile int a;
+
+void main (void)
+{
+ for (int i = 0; i < 1000; i++)
+ if (i % 17)
+ a++;
+}
diff --git a/gcc/testsuite/gcc.dg/pr102798.c b/gcc/testsuite/gcc.dg/pr102798.c
new file mode 100644
index 0000000..3a50546
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102798.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-tree-pta" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+__attribute__((__noipa__))
+void BUF_reverse (unsigned char *out, const unsigned char *in, size_t size)
+{
+ size_t i;
+ if (in)
+ {
+ out += size - 1;
+ for (i = 0; i < size; i++)
+ *out++ = *in++;
+ }
+ else
+ {
+ unsigned char *q;
+ char c;
+ q = out + size - 1;
+ for (i = 0; i < size ; i++)
+ {
+ *out++ = 1;
+ }
+ }
+}
+
+int
+main (void)
+{
+ unsigned char buf[40];
+ unsigned char buf1[40];
+ for (unsigned i = 0; i < sizeof (buf); i++)
+ buf[i] = i;
+ BUF_reverse (buf, 0, sizeof (buf));
+ for (unsigned i = 0; i < sizeof (buf); i++)
+ if (buf[i] != 1)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr102827.c b/gcc/testsuite/gcc.dg/pr102827.c
new file mode 100644
index 0000000..eed3eba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102827.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vectorize --param ssa-name-def-chain-limit=0" } */
+/* { dg-additional-options "-mavx" { target { x86_64-*-* i?86-*-* } } } */
+
+void
+test_double_double_nugt_var (double *dest, double *src, int b, int i)
+{
+ while (i < 1)
+ {
+ dest[i] = b ? src[i] : 0.0;
+ ++i;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr102897.c b/gcc/testsuite/gcc.dg/pr102897.c
new file mode 100644
index 0000000..8e0d25e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102897.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* Specify C99 to avoid the warning/error on compound literals. */
+/* { dg-options "-O1 -std=c99 -Wno-psabi" } */
+
+/* Verify that there is no ICE. */
+
+typedef __attribute__((vector_size(8))) signed char int8x8_t;
+typedef __attribute__((vector_size(8))) unsigned char uint8x8_t;
+
+int8x8_t fn1 (int8x8_t val20, char tmp)
+{
+ uint8x8_t __trans_tmp_3;
+ __trans_tmp_3 = (uint8x8_t){tmp};
+ int8x8_t __a = (int8x8_t) __trans_tmp_3;
+ return __builtin_shuffle (__a, val20, (uint8x8_t){0});
+}
diff --git a/gcc/testsuite/gcc.dg/pr36902.c b/gcc/testsuite/gcc.dg/pr36902.c
index 7dafc9a..365a26e 100644
--- a/gcc/testsuite/gcc.dg/pr36902.c
+++ b/gcc/testsuite/gcc.dg/pr36902.c
@@ -24,10 +24,9 @@ struct {
unsigned char pcr_select[4];
} sel;
+unsigned char buf[64];
int bar(void)
{
- static unsigned char buf[64];
-
sel.size_of_select = 3;
foo(buf, sel.pcr_select, sel.size_of_select);
@@ -52,8 +51,6 @@ foo2(unsigned char * to, const unsigned char * from, int n)
int baz(void)
{
- static unsigned char buf[64];
-
sel.size_of_select = 5;
foo2(buf, sel.pcr_select, sel.size_of_select);
diff --git a/gcc/testsuite/gcc.dg/shrink-wrap-loop.c b/gcc/testsuite/gcc.dg/shrink-wrap-loop.c
index 6e1be893..ddc99e6 100644
--- a/gcc/testsuite/gcc.dg/shrink-wrap-loop.c
+++ b/gcc/testsuite/gcc.dg/shrink-wrap-loop.c
@@ -1,58 +1,6 @@
/* { dg-do compile { target { { { i?86-*-* x86_64-*-* } && lp64 } || { arm_thumb2 } } } } */
/* { dg-options "-O2 -fdump-rtl-pro_and_epilogue" } */
-/*
-Our new threader is threading things a bit too early, and causing the
-testcase in gcc.dg/shrink-wrap-loop.c to fail.
-
- The gist is this BB inside a loop:
-
- <bb 6> :
- # p_2 = PHI <p2_6(D)(2), p_12(5)>
- if (p_2 != 0B)
- goto <bb 3>; [INV]
- else
- goto <bb 7>; [INV]
-
-Our threader can move this check outside of the loop (good). This is
-done before branch probabilities are calculated and causes the probs
-to be calculated as:
-
-<bb 2> [local count: 216361238]:
- if (p2_6(D) != 0B)
- goto <bb 7>; [54.59%]
- else
- goto <bb 6>; [45.41%]
-
-Logically this seems correct to me. A simple check outside of a loop
-should slightly but not overwhelmingly favor a non-zero value.
-
-Interestingly however, the old threader couldn't get this, but the IL
-ended up identical, albeit with different probabilities. What happens
-is that, because the old code could not thread this, the p2 != 0 check
-would remain inside the loop and probs would be calculated thusly:
-
- <bb 6> [local count: 1073741824]:
- # p_2 = PHI <p2_6(D)(2), p_12(5)>
- if (p_2 != 0B)
- goto <bb 3>; [94.50%]
- else
- goto <bb 7>; [5.50%]
-
-Then when the loop header copying pass ("ch") shuffled things around,
-the IL would end up identical to my early threader code, but with the
-probabilities would remain as 94.5/5.5.
-
-The above discrepancy causes the RTL ifcvt pass to generate different
-code, and by the time we get to the shrink wrapping pass, things look
-sufficiently different such that the legacy code can actually shrink
-wrap, whereas our new code does not.
-
-IMO, if the loop-ch pass moves conditionals outside of a loop, the
-probabilities should be adjusted, but that does mean the shrink wrap
-won't happen for this contrived testcase.
- */
-
int foo (int *p1, int *p2);
int
@@ -68,4 +16,4 @@ test (int *p1, int *p2)
return 1;
}
-/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" { xfail *-*-* } } } */
+/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr102762.c b/gcc/testsuite/gcc.dg/torture/pr102762.c
new file mode 100644
index 0000000..67c6b00
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr102762.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* We fail to diagnose the invalid __builtin_va_arg_pack use with -flto. */
+/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
+
+void log_bad_request();
+void foo(a, b)
+ int a, b;
+{
+ log_bad_request(0, __builtin_va_arg_pack()); /* { dg-error "invalid use" } */
+ foo(0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr102920.c b/gcc/testsuite/gcc.dg/torture/pr102920.c
new file mode 100644
index 0000000..aa27ac5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr102920.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-additional-options "-funswitch-loops" } */
+
+unsigned short a = 42;
+unsigned short b = 1;
+long int c = 1;
+unsigned char var_120;
+unsigned char var_123;
+
+void __attribute__((noipa)) test(unsigned short a, unsigned short b, long c)
+{
+ for (char i = 0; i < (char)c; i += 5)
+ if (!b)
+ var_120 = a;
+ else
+ var_123 = a;
+}
+
+int main()
+{
+ test(a, b, c);
+ if (var_123 != 42)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr69760.c b/gcc/testsuite/gcc.dg/torture/pr69760.c
index 53733c7..47e01ae 100644
--- a/gcc/testsuite/gcc.dg/torture/pr69760.c
+++ b/gcc/testsuite/gcc.dg/torture/pr69760.c
@@ -1,11 +1,10 @@
/* PR tree-optimization/69760 */
/* { dg-do run { target { { *-*-linux* *-*-gnu* *-*-uclinux* } && mmap } } } */
-/* { dg-options "-O2" } */
#include <unistd.h>
#include <sys/mman.h>
-__attribute__((noinline, noclone)) void
+__attribute__((noinline, noclone)) static void
test_func (double *a, int L, int m, int n, int N)
{
int i, k;
diff --git a/gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c b/gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c
index 1f30467..de019a7 100644
--- a/gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c
+++ b/gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c
@@ -6,13 +6,13 @@ extern void abort (void);
int *g;
int dummy;
-int * __attribute__((noinline,const))
+int * __attribute__((noinline,const,noipa))
foo_const(int *p) { return p; }
-int * __attribute__((noinline,pure))
+int * __attribute__((noinline,pure,noipa))
foo_pure(int *p) { return p + dummy; }
-int * __attribute__((noinline))
+int * __attribute__((noinline,noipa))
foo_normal(int *p) { g = p; return p; }
void test_const(void)
@@ -58,4 +58,4 @@ int main()
/* { dg-final { scan-tree-dump "q_const_. = { NONLOCAL i }" "alias" } } */
/* { dg-final { scan-tree-dump "q_pure_. = { ESCAPED NONLOCAL i }" "alias" } } */
-/* { dg-final { scan-tree-dump "q_normal_. = { ESCAPED NONLOCAL }" "alias" } } */
+/* { dg-final { scan-tree-dump "q_normal_. = { ESCAPED NONLOCAL i }" "alias" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-23.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-23.c
index 7fb9651..112b08a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-23.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-23.c
@@ -214,12 +214,14 @@ void test_struct_member_array (struct S3 *s3, int i)
T (d, "%s", d); /* { dg-warning "overlaps" } */
T (d, "%s", d + 0); /* { dg-warning "overlaps" } */
T (d, "%s", d + 1); /* { dg-warning "may overlap" } */
- T (d, "%s", d + 2); /* { dg-warning "may overlap" } */
+ /* Since d below points to char[4], strlen(d + 2) must be at most 1
+ and so the call cannot overlap. */
+ T (d, "%s", d + 2);
T (d, "%s", d + i); /* { dg-warning "may overlap" } */
T (d, "%s", &d[0]); /* { dg-warning "overlaps" } */
T (d, "%s", &d[1]); /* { dg-warning "may overlap" } */
- T (d, "%s", &d[2]); /* { dg-warning "may overlap" } */
+ T (d, "%s", &d[2]);
T (d, "%s", &d[i]); /* { dg-warning "may overlap" } */
T (d + 0, "%s", d); /* { dg-warning "overlaps" } */
@@ -236,7 +238,7 @@ void test_struct_member_array (struct S3 *s3, int i)
T (d, "%s", s); /* { dg-warning "overlaps" } */
T (d, "%s", s + 1); /* { dg-warning "may overlap" } */
- T (d, "%s", s + 2); /* { dg-warning "may overlap" } */
+ T (d, "%s", s + 2);
T (d, "%s", s + i); /* { dg-warning "may overlap" } */
s = s3->s2_1.s_1.b;
@@ -324,7 +326,7 @@ void test_struct_member_array (struct S3 *s3, int i)
T (d, "%s", s); /* { dg-warning "overlaps" } */
T (d, "%s", s + 1); /* { dg-warning "may overlap" } */
- T (d, "%s", s + 2); /* { dg-warning "may overlap" } */
+ T (d, "%s", s + 2);
T (d, "%s", s + i); /* { dg-warning "may overlap" } */
s = s3->s2_2.s_2.a;
@@ -368,7 +370,7 @@ void test_struct_member_array (struct S3 *s3, int i)
T (d, "%s", s); /* { dg-warning "overlaps" } */
T (d, "%s", s + 1); /* { dg-warning "may overlap" } */
- T (d, "%s", s + 2); /* { dg-warning "may overlap" } */
+ T (d, "%s", s + 2);
T (d, "%s", s + i); /* { dg-warning "may overlap" } */
s = s3->s2_2.s_2.a;
@@ -394,12 +396,12 @@ void test_struct_member_array_array (struct S3 *s3, int i)
T (d, "%s", s); /* { dg-warning "overlaps" } */
T (d, "%s", s + 0); /* { dg-warning "overlaps" } */
T (d, "%s", s + 1); /* { dg-warning "may overlap" } */
- T (d, "%s", s + 2); /* { dg-warning "may overlap" } */
+ T (d, "%s", s + 2);
T (d, "%s", s + i); /* { dg-warning "may overlap" } */
T (d, "%s", &s[0]); /* { dg-warning "overlaps" } */
T (d, "%s", &s[1]); /* { dg-warning "may overlap" } */
- T (d, "%s", &s[2]); /* { dg-warning "may overlap" } */
+ T (d, "%s", &s[2]);
T (d, "%s", &s[i]); /* { dg-warning "may overlap" } */
T (d + 0, "%s", s); /* { dg-warning "overlaps" } */
@@ -566,12 +568,12 @@ void test_union_member_array (union U *un, int i)
T (d, "%s", d); /* { dg-warning "overlaps" } */
T (d, "%s", d + 0); /* { dg-warning "overlaps" } */
T (d, "%s", d + 1); /* { dg-warning "may overlap" } */
- T (d, "%s", d + 2); /* { dg-warning "may overlap" } */
+ T (d, "%s", d + 2);
T (d, "%s", d + i); /* { dg-warning "may overlap" } */
T (d, "%s", &d[0]); /* { dg-warning "overlaps" } */
T (d, "%s", &d[1]); /* { dg-warning "may overlap" } */
- T (d, "%s", &d[2]); /* { dg-warning "may overlap" } */
+ T (d, "%s", &d[2]);
T (d, "%s", &d[i]); /* { dg-warning "may overlap" } */
T (d + 0, "%s", d); /* { dg-warning "overlaps" } */
@@ -588,7 +590,7 @@ void test_union_member_array (union U *un, int i)
T (d, "%s", s); /* { dg-warning "overlaps" } */
T (d, "%s", s + 1); /* { dg-warning "may overlap" } */
- T (d, "%s", s + 2); /* { dg-warning "may overlap" } */
+ T (d, "%s", s + 2);
T (d, "%s", s + i); /* { dg-warning "may overlap" } */
s = un->s2_1.s_1.b;
@@ -616,7 +618,7 @@ void test_union_member_array (union U *un, int i)
T (d, "%s", s); /* { dg-warning "overlaps" } */
T (d, "%s", s + 1); /* { dg-warning "may overlap" } */
- T (d, "%s", s + 2); /* { dg-warning "may overlap" } */
+ T (d, "%s", s + 2);
T (d, "%s", s + i); /* { dg-warning "may overlap" } */
s = un->s2_2.s_1.b;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifc-20040816-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ifc-20040816-1.c
index b55a533..f8a6495 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ifc-20040816-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ifc-20040816-1.c
@@ -39,4 +39,4 @@ int main1 ()
which is folded by vectorizer. Both outgoing edges must have probability
100% so the resulting profile match after folding. */
/* { dg-final { scan-tree-dump-times "Invalid sum of outgoing probabilities 200.0" 1 "ifcvt" } } */
-/* { dg-final { scan-tree-dump-times "Invalid sum of incoming counts" 1 "ifcvt" } } */
+/* { dg-final { scan-tree-dump-times "Invalid sum of incoming counts" 2 "ifcvt" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-rawmemchr-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-rawmemchr-1.c
new file mode 100644
index 0000000..6abfd27
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-rawmemchr-1.c
@@ -0,0 +1,72 @@
+/* { dg-do run { target s390x-*-* } } */
+/* { dg-options "-O2 -ftree-loop-distribution -fdump-tree-ldist-details" } */
+/* { dg-final { scan-tree-dump-times "generated rawmemchrQI" 2 "ldist" { target s390x-*-* } } } */
+/* { dg-final { scan-tree-dump-times "generated rawmemchrHI" 2 "ldist" { target s390x-*-* } } } */
+/* { dg-final { scan-tree-dump-times "generated rawmemchrSI" 2 "ldist" { target s390x-*-* } } } */
+
+/* Rawmemchr pattern: reduction stmt and no store */
+
+#include <stdint.h>
+#include <assert.h>
+
+typedef __SIZE_TYPE__ size_t;
+extern void* malloc (size_t);
+extern void* memset (void*, int, size_t);
+
+#define test(T, pattern) \
+__attribute__((noinline)) \
+T *test_##T (T *p) \
+{ \
+ while (*p != (T)pattern) \
+ ++p; \
+ return p; \
+}
+
+test (uint8_t, 0xab)
+test (uint16_t, 0xabcd)
+test (uint32_t, 0xabcdef15)
+
+test (int8_t, 0xab)
+test (int16_t, 0xabcd)
+test (int32_t, 0xabcdef15)
+
+#define run(T, pattern, i) \
+{ \
+T *q = p; \
+q[i] = (T)pattern; \
+assert (test_##T (p) == &q[i]); \
+q[i] = 0; \
+}
+
+int main(void)
+{
+ void *p = malloc (1024);
+ assert (p);
+ memset (p, 0, 1024);
+
+ run (uint8_t, 0xab, 0);
+ run (uint8_t, 0xab, 1);
+ run (uint8_t, 0xab, 13);
+
+ run (uint16_t, 0xabcd, 0);
+ run (uint16_t, 0xabcd, 1);
+ run (uint16_t, 0xabcd, 13);
+
+ run (uint32_t, 0xabcdef15, 0);
+ run (uint32_t, 0xabcdef15, 1);
+ run (uint32_t, 0xabcdef15, 13);
+
+ run (int8_t, 0xab, 0);
+ run (int8_t, 0xab, 1);
+ run (int8_t, 0xab, 13);
+
+ run (int16_t, 0xabcd, 0);
+ run (int16_t, 0xabcd, 1);
+ run (int16_t, 0xabcd, 13);
+
+ run (int32_t, 0xabcdef15, 0);
+ run (int32_t, 0xabcdef15, 1);
+ run (int32_t, 0xabcdef15, 13);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-rawmemchr-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-rawmemchr-2.c
new file mode 100644
index 0000000..00d6ea0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-rawmemchr-2.c
@@ -0,0 +1,83 @@
+/* { dg-do run { target s390x-*-* } } */
+/* { dg-options "-O2 -ftree-loop-distribution -fdump-tree-ldist-details" } */
+/* { dg-final { scan-tree-dump-times "generated rawmemchrQI" 2 "ldist" { target s390x-*-* } } } */
+/* { dg-final { scan-tree-dump-times "generated rawmemchrHI" 2 "ldist" { target s390x-*-* } } } */
+/* { dg-final { scan-tree-dump-times "generated rawmemchrSI" 2 "ldist" { target s390x-*-* } } } */
+
+/* Rawmemchr pattern: reduction stmt and store */
+
+#include <stdint.h>
+#include <assert.h>
+
+typedef __SIZE_TYPE__ size_t;
+extern void* malloc (size_t);
+extern void* memset (void*, int, size_t);
+
+uint8_t *p_uint8_t;
+uint16_t *p_uint16_t;
+uint32_t *p_uint32_t;
+
+int8_t *p_int8_t;
+int16_t *p_int16_t;
+int32_t *p_int32_t;
+
+#define test(T, pattern) \
+__attribute__((noinline)) \
+T *test_##T (void) \
+{ \
+ while (*p_##T != pattern) \
+ ++p_##T; \
+ return p_##T; \
+}
+
+test (uint8_t, 0xab)
+test (uint16_t, 0xabcd)
+test (uint32_t, 0xabcdef15)
+
+test (int8_t, (int8_t)0xab)
+test (int16_t, (int16_t)0xabcd)
+test (int32_t, (int32_t)0xabcdef15)
+
+#define run(T, pattern, i) \
+{ \
+T *q = p; \
+q[i] = pattern; \
+p_##T = p; \
+T *r = test_##T (); \
+assert (r == p_##T); \
+assert (r == &q[i]); \
+q[i] = 0; \
+}
+
+int main(void)
+{
+ void *p = malloc (1024);
+ assert (p);
+ memset (p, '\0', 1024);
+
+ run (uint8_t, 0xab, 0);
+ run (uint8_t, 0xab, 1);
+ run (uint8_t, 0xab, 13);
+
+ run (uint16_t, 0xabcd, 0);
+ run (uint16_t, 0xabcd, 1);
+ run (uint16_t, 0xabcd, 13);
+
+ run (uint32_t, 0xabcdef15, 0);
+ run (uint32_t, 0xabcdef15, 1);
+ run (uint32_t, 0xabcdef15, 13);
+
+ run (int8_t, (int8_t)0xab, 0);
+ run (int8_t, (int8_t)0xab, 1);
+ run (int8_t, (int8_t)0xab, 13);
+
+ run (int16_t, (int16_t)0xabcd, 0);
+ run (int16_t, (int16_t)0xabcd, 1);
+ run (int16_t, (int16_t)0xabcd, 13);
+
+ run (int32_t, (int32_t)0xabcdef15, 0);
+ run (int32_t, (int32_t)0xabcdef15, 1);
+ run (int32_t, (int32_t)0xabcdef15, 13);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-1.c
new file mode 100644
index 0000000..918b600
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-1.c
@@ -0,0 +1,100 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -ftree-loop-distribution -fdump-tree-ldist-details" } */
+/* { dg-final { scan-tree-dump-times "generated strlenQI\n" 4 "ldist" } } */
+/* { dg-final { scan-tree-dump-times "generated strlenHI\n" 4 "ldist" { target s390x-*-* } } } */
+/* { dg-final { scan-tree-dump-times "generated strlenSI\n" 4 "ldist" { target s390x-*-* } } } */
+
+#include <stdint.h>
+#include <assert.h>
+
+typedef __SIZE_TYPE__ size_t;
+extern void* malloc (size_t);
+extern void* memset (void*, int, size_t);
+
+#define test(T, U) \
+__attribute__((noinline)) \
+U test_##T##U (T *s) \
+{ \
+ U i; \
+ for (i=0; s[i]; ++i); \
+ return i; \
+}
+
+test (uint8_t, size_t)
+test (uint16_t, size_t)
+test (uint32_t, size_t)
+test (uint8_t, int)
+test (uint16_t, int)
+test (uint32_t, int)
+
+test (int8_t, size_t)
+test (int16_t, size_t)
+test (int32_t, size_t)
+test (int8_t, int)
+test (int16_t, int)
+test (int32_t, int)
+
+#define run(T, U, i) \
+{ \
+T *q = p; \
+q[i] = 0; \
+assert (test_##T##U (p) == i); \
+memset (&q[i], 0xf, sizeof (T)); \
+}
+
+int main(void)
+{
+ void *p = malloc (1024);
+ assert (p);
+ memset (p, 0xf, 1024);
+
+ run (uint8_t, size_t, 0);
+ run (uint8_t, size_t, 1);
+ run (uint8_t, size_t, 13);
+
+ run (int8_t, size_t, 0);
+ run (int8_t, size_t, 1);
+ run (int8_t, size_t, 13);
+
+ run (uint8_t, int, 0);
+ run (uint8_t, int, 1);
+ run (uint8_t, int, 13);
+
+ run (int8_t, int, 0);
+ run (int8_t, int, 1);
+ run (int8_t, int, 13);
+
+ run (uint16_t, size_t, 0);
+ run (uint16_t, size_t, 1);
+ run (uint16_t, size_t, 13);
+
+ run (int16_t, size_t, 0);
+ run (int16_t, size_t, 1);
+ run (int16_t, size_t, 13);
+
+ run (uint16_t, int, 0);
+ run (uint16_t, int, 1);
+ run (uint16_t, int, 13);
+
+ run (int16_t, int, 0);
+ run (int16_t, int, 1);
+ run (int16_t, int, 13);
+
+ run (uint32_t, size_t, 0);
+ run (uint32_t, size_t, 1);
+ run (uint32_t, size_t, 13);
+
+ run (int32_t, size_t, 0);
+ run (int32_t, size_t, 1);
+ run (int32_t, size_t, 13);
+
+ run (uint32_t, int, 0);
+ run (uint32_t, int, 1);
+ run (uint32_t, int, 13);
+
+ run (int32_t, int, 0);
+ run (int32_t, int, 1);
+ run (int32_t, int, 13);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-2.c
new file mode 100644
index 0000000..e25d6ea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-2.c
@@ -0,0 +1,58 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -ftree-loop-distribution -fdump-tree-ldist-details" } */
+/* { dg-final { scan-tree-dump-times "generated strlenQI\n" 3 "ldist" } } */
+
+#include <assert.h>
+
+typedef __SIZE_TYPE__ size_t;
+extern void* malloc (size_t);
+extern void* memset (void*, int, size_t);
+
+__attribute__((noinline))
+int test_pos (char *s)
+{
+ int i;
+ for (i=42; s[i]; ++i);
+ return i;
+}
+
+__attribute__((noinline))
+int test_neg (char *s)
+{
+ int i;
+ for (i=-42; s[i]; ++i);
+ return i;
+}
+
+__attribute__((noinline))
+int test_including_null_char (char *s)
+{
+ int i;
+ for (i=1; s[i-1]; ++i);
+ return i;
+}
+
+int main(void)
+{
+ void *p = malloc (1024);
+ assert (p);
+ memset (p, 0xf, 1024);
+ char *s = (char *)p + 100;
+
+ s[42+13] = 0;
+ assert (test_pos (s) == 42+13);
+ s[42+13] = 0xf;
+
+ s[13] = 0;
+ assert (test_neg (s) == 13);
+ s[13] = 0xf;
+
+ s[-13] = 0;
+ assert (test_neg (s) == -13);
+ s[-13] = 0xf;
+
+ s[13] = 0;
+ assert (test_including_null_char (s) == 13+1);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-3.c
new file mode 100644
index 0000000..370fd5e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-strlen-3.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-loop-distribution -fdump-tree-ldist-details" } */
+/* { dg-final { scan-tree-dump-times "generated strlenSI\n" 1 "ldist" { target s390x-*-* } } } */
+
+extern int s[];
+
+int test ()
+{
+ int i = 0;
+ for (; s[i]; ++i);
+ return i;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr102736.c b/gcc/testsuite/gcc.dg/tree-ssa/pr102736.c
new file mode 100644
index 0000000..c693a71
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr102736.c
@@ -0,0 +1,21 @@
+// { dg-do run }
+// { dg-options "-O1 -ftree-vrp" }
+
+int a, b = -1, c;
+int d = 1;
+static inline signed char e(signed char f, int g) { return g ? f : 0; }
+static inline signed char h(signed char f) { return f < a ? f : f < a; }
+static inline unsigned char i(unsigned char f, int g) { return g ? f : f > g; }
+void j() {
+L:
+ c = e(1, i(h(b), d));
+ if (b)
+ return;
+ goto L;
+}
+int main() {
+ j();
+ if (c != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c
index 2f91458..496c425 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining -fdelete-null-pointer-checks" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining -fdelete-null-pointer-checks -fdisable-tree-thread1" } */
typedef struct {
int code;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c
index c8968577..8112967 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c
@@ -4,7 +4,7 @@
immediate successors of the basic block. */
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-dominator-opts -fdisable-tree-evrp -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */
+/* { dg-options "-O2 -fno-thread-jumps -fdisable-tree-evrp -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */
extern void bar (int);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c
index aadd53e..9b93d39 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fdump-tree-dce2 -fdelete-null-pointer-checks" } */
+/* { dg-options "-O2 -fno-thread-jumps -fdisable-tree-evrp -fdump-tree-vrp1 -fdump-tree-dce2 -fdelete-null-pointer-checks" } */
int
foo (int *p)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c
index 3909adb..92a8768 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */
+/* { dg-options "-O2 -fno-thread-jumps -fdisable-tree-evrp -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */
int g, h;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
index 51b3b7a..43f046e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c
@@ -35,10 +35,7 @@ void foo (void)
/* First, we should simplify the bits < 0 test within the loop. */
/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "evrp" } } */
-/* Second, we should thread the edge out of the loop via the break
- statement. We also realize that the final bytes == 0 test is useless,
- and thread over it. We also know that toread != 0 is useless when
- entering while loop and thread over it. */
-/* { dg-final { scan-tree-dump-times "Threaded jump" 3 "vrp-thread1" } } */
+/* We used to check for 3 threaded jumps here, but they all would
+ rotate the loop. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr25382.c b/gcc/testsuite/gcc.dg/tree-ssa/pr25382.c
index d747655..8634c0a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr25382.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr25382.c
@@ -3,7 +3,7 @@
Check that VRP now gets ranges from BIT_AND_EXPRs. */
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-ccp -fdisable-tree-evrp -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fno-thread-jumps -fno-tree-ccp -fdisable-tree-evrp -fdump-tree-vrp1" } */
int
foo (int a)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c b/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c
index 42898e7..f11623b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c
@@ -1,5 +1,5 @@
/* { dg-do compile { target { ! keeps_null_pointer_checks } } } */
-/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */
+/* { dg-options "-O2 -fno-thread-jumps -fdisable-tree-evrp -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */
extern void eliminate (void);
extern void* f1 (void *a, void *b) __attribute__((nonnull));
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr59597.c b/gcc/testsuite/gcc.dg/tree-ssa/pr59597.c
index 2caa1f5..764b3fe 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr59597.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr59597.c
@@ -56,11 +56,7 @@ main (int argc, char argv[])
return crc;
}
-/* Previously we had 3 jump threads, but one of them crossed loops.
- The reason the old threader was allowing it, was because there was
- an ASSERT_EXPR getting in the way. Without the ASSERT_EXPR, we
- have an empty pre-header block as the final block in the thread,
- which the threader will simply join with the next block which *is*
- in a different loop. */
-/* { dg-final { scan-tree-dump-times "Registering jump thread" 2 "vrp-thread1" } } */
+/* None of the threads we can get in vrp-thread1 are valid. They all
+ cross or rotate loops. */
+/* { dg-final { scan-tree-dump-not "Registering jump thread" "vrp-thread1" } } */
/* { dg-final { scan-tree-dump-not "joiner" "vrp-thread1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr71437.c b/gcc/testsuite/gcc.dg/tree-ssa/pr71437.c
index a2386ba..eab3a25 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr71437.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr71437.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-ffast-math -O3 -fdump-tree-vrp-thread1-details" } */
+/* { dg-options "-ffast-math -O3 -fdump-tree-dom3-details" } */
int I = 50, J = 50;
int S, L;
@@ -39,4 +39,8 @@ void foo (int K)
bar (LD, SD);
}
}
-/* { dg-final { scan-tree-dump-times "Threaded jump " 2 "vrp-thread1" } } */
+
+/* We used to get 1 vrp-thread1 candidates here, but they now get
+ deferred until after loop opts are done, because they were rotating
+ loops. */
+/* { dg-final { scan-tree-dump-times "Threaded jump " 2 "dom3" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
index 18f7aab..f2a5e78 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
@@ -123,8 +123,7 @@ enum STATES FMS( u8 **in , u32 *transitions) {
aarch64 has the highest CASE_VALUES_THRESHOLD in GCC. It's high enough
to change decisions in switch expansion which in turn can expose new
jump threading opportunities. Skip the later tests on aarch64. */
-/* { dg-final { scan-tree-dump "Jumps threaded: \[7-9\]" "thread1" } } */
-/* { dg-final { scan-tree-dump-times "Invalid sum" 1 "thread1" } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: \[7-9\]" "thread2" } } */
/* { dg-final { scan-tree-dump-not "optimizing for size" "thread1" } } */
/* { dg-final { scan-tree-dump-not "optimizing for size" "thread2" } } */
/* { dg-final { scan-tree-dump-not "optimizing for size" "thread3" { target { ! aarch64*-*-* } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-3.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-3.c
index 1174cd1..9abbe6c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/predcom-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-3.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details -fno-tree-pre" } */
+/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details -fno-tree-pre -fno-tree-loop-vectorize" } */
int a[1000], b[1000];
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c
index cb85ec1..aa639b4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c
@@ -22,5 +22,5 @@ int bar (int b)
return *foo (&q);
}
-/* { dg-final { scan-tree-dump "CALLUSED\\(\[0-9\]+\\) = { f.* i q }" "alias" } } */
+/* { dg-final { scan-tree-dump "CALLUSED\\(\[0-9\]+\\) = { NONLOCAL f.* i q }" "alias" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-9.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-9.c
new file mode 100644
index 0000000..e1ffa7f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-9.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-cddce1" } */
+
+int main()
+{
+ while(1)
+ for(int i=0; i<9000000; i++){}
+}
+
+/* { dg-final { scan-tree-dump-not "if" "cddce1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-18.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-18.c
deleted file mode 100644
index 0246ebf..0000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-18.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp-thread1-details -std=gnu89 --param logical-op-non-short-circuit=0" } */
-
-#include "ssa-dom-thread-4.c"
-
-/* On targets that define LOGICAL_OP_NON_SHORT_CIRCUIT to 0, we split both
- "a_elt || b_elt" and "b_elt && kill_elt" into two conditions each,
- rather than using "(var1 != 0) op (var2 != 0)". Also, as on other targets,
- we duplicate the header of the inner "while" loop. There are then
- 4 threading opportunities:
-
- 1x "!a_elt && b_elt" in the outer "while" loop
- -> the start of the inner "while" loop,
- skipping the known-true "b_elt" in the first condition.
- 1x "!b_elt" in the first condition
- -> the outer "while" loop's continuation point,
- skipping the known-false "b_elt" in the second condition.
- 2x "kill_elt->indx >= b_elt->indx" in the first "while" loop
- -> "kill_elt->indx == b_elt->indx" in the second condition,
- skipping the known-true "b_elt && kill_elt" in the second
- condition.
-
- All the cases are picked up by VRP1 as jump threads. */
-
-/* There used to be 6 jump threads found by thread1, but they all
- depended on threading through distinct loops in ethread. */
-/* { dg-final { scan-tree-dump-times "Threaded" 2 "vrp-thread1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2a.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2a.c
deleted file mode 100644
index 8f0a12c..0000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2a.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp-thread1-stats -fdump-tree-dom2-stats" } */
-
-void bla();
-
-/* In the following case, we should be able to thread edge through
- the loop header. */
-
-void thread_entry_through_header (void)
-{
- int i;
-
- for (i = 0; i < 170; i++)
- bla ();
-}
-
-/* There's a single jump thread that should be handled by the VRP
- jump threading pass. */
-/* { dg-final { scan-tree-dump-times "Jumps threaded: 1" 1 "vrp-thread1"} } */
-/* { dg-final { scan-tree-dump-times "Jumps threaded: 2" 0 "vrp-thread1"} } */
-/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom2"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-4.c
deleted file mode 100644
index 46e464f..0000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-4.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp-thread1-details -fdump-tree-dom2-details -std=gnu89 --param logical-op-non-short-circuit=1" } */
-struct bitmap_head_def;
-typedef struct bitmap_head_def *bitmap;
-typedef const struct bitmap_head_def *const_bitmap;
-typedef unsigned long BITMAP_WORD;
-typedef struct bitmap_element_def
-{
- struct bitmap_element_def *next;
- unsigned int indx;
-} bitmap_element;
-
-
-
-
-
-
-
-
-
-unsigned char
-bitmap_ior_and_compl (bitmap dst, const_bitmap a, const_bitmap b,
- const_bitmap kill)
-{
- unsigned char changed = 0;
-
- bitmap_element *dst_elt;
- const bitmap_element *a_elt, *b_elt, *kill_elt, *dst_prev;
-
- while (a_elt || b_elt)
- {
- unsigned char new_element = 0;
-
- if (b_elt)
- while (kill_elt && kill_elt->indx < b_elt->indx)
- kill_elt = kill_elt->next;
-
- if (b_elt && kill_elt && kill_elt->indx == b_elt->indx
- && (!a_elt || a_elt->indx >= b_elt->indx))
- {
- bitmap_element tmp_elt;
- unsigned ix;
-
- BITMAP_WORD ior = 0;
-
- changed = bitmap_elt_ior (dst, dst_elt, dst_prev,
- a_elt, &tmp_elt, changed);
-
- }
-
- }
-
-
- return changed;
-}
-/* The block starting the second conditional has 3 incoming edges,
- we should thread all three, but due to a bug in the threading
- code we missed the edge when the first conditional is false
- (b_elt is zero, which means the second conditional is always
- zero. VRP1 catches all three. */
-/* { dg-final { scan-tree-dump-times "Registering jump thread" 2 "vrp-thread1" } } */
-/* { dg-final { scan-tree-dump-times "Path crosses loops" 1 "vrp-thread1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c
deleted file mode 100644
index b0a7d42..0000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-thread1-details -fdump-tree-thread3-details" } */
-
-/* { dg-final { scan-tree-dump-times "Registering jump" 6 "thread1" } } */
-/* { dg-final { scan-tree-dump-times "Registering jump" 1 "thread3" } } */
-
-int sum0, sum1, sum2, sum3;
-int foo (char *s, char **ret)
-{
- int state=0;
- char c;
-
- for (; *s && state != 4; s++)
- {
- c = *s;
- if (c == '*')
- {
- s++;
- break;
- }
- switch (state)
- {
- case 0:
- if (c == '+')
- state = 1;
- else if (c != '-')
- sum0+=c;
- break;
- case 1:
- if (c == '+')
- state = 2;
- else if (c == '-')
- state = 0;
- else
- sum1+=c;
- break;
- default:
- break;
- }
-
- }
- *ret = s;
- return state;
-}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
index 16abcde..ee17edd 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
@@ -1,15 +1,15 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-thread1-stats -fdump-tree-thread2-stats -fdump-tree-dom2-stats -fdump-tree-thread3-stats -fdump-tree-dom3-stats -fdump-tree-vrp2-stats -fno-guess-branch-probability" } */
+/* { dg-options "-O2 -fdump-tree-dom2-stats -fdump-tree-thread3-stats -fdump-tree-dom3-stats -fdump-tree-vrp-thread2-stats -fno-guess-branch-probability" } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 12" "thread1" } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 5" "thread3" { target { ! aarch64*-*-* } } } } */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom2" } } */
/* aarch64 has the highest CASE_VALUES_THRESHOLD in GCC. It's high enough
to change decisions in switch expansion which in turn can expose new
jump threading opportunities. Skip the later tests on aarch64. */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom3" { target { ! aarch64*-*-* } } } } */
-/* { dg-final { scan-tree-dump-not "Jumps threaded" "vrp2" { target { ! aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump-not "Jumps threaded" "vrp-thread2" { target { ! aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 11" "thread3" { target { ! aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 18" "thread3" { target { aarch64*-*-* } } } } */
enum STATE {
S0=0,
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-97.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-97.c
new file mode 100644
index 0000000..2f09c8b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-97.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* ethread threading does not yet catch this but it might at some point. */
+/* { dg-options "-O -fdump-tree-fre1-details -fno-thread-jumps" } */
+
+int foo (int b, int x)
+{
+ int i, j;
+ if (b)
+ i = x;
+ if (b)
+ j = x;
+ return j == i;
+}
+
+/* Even with different undefs we should CSE a PHI node with the
+ same controlling condition. */
+
+/* { dg-final { scan-tree-dump "Replaced redundant PHI node" "fre1" } } */
+/* { dg-final { scan-tree-dump "return 1;" "fre1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c
deleted file mode 100644
index 672a54e..0000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp2-details --param logical-op-non-short-circuit=1" } */
-/* { dg-additional-options "-fdisable-tree-ethread -fdisable-tree-thread1 -fdisable-tree-thread2" } */
-/* { dg-final { scan-tree-dump-not "IRREDUCIBLE_LOOP" "vrp2" } } */
-
-void abort (void);
-typedef struct bitmap_head_def *bitmap;
-typedef const struct bitmap_head_def *const_bitmap;
-typedef struct bitmap_obstack
-{
- struct bitmap_obstack *next;
- unsigned int indx;
-}
-bitmap_element;
-typedef struct bitmap_head_def
-{
- bitmap_element *first;
-}
-bitmap_head;
-static __inline__ unsigned char
-bitmap_elt_ior (bitmap dst, bitmap_element * dst_elt,
- bitmap_element * dst_prev, const bitmap_element * a_elt,
- const bitmap_element * b_elt)
-{
- ((void) (!(a_elt || b_elt) ? abort (), 0 : 0));
-}
-
-unsigned char
-bitmap_ior_and_compl (bitmap dst, const_bitmap a, const_bitmap b,
- const_bitmap kill)
-{
- bitmap_element *dst_elt = dst->first;
- const bitmap_element *a_elt = a->first;
- const bitmap_element *b_elt = b->first;
- const bitmap_element *kill_elt = kill->first;
- bitmap_element *dst_prev = ((void *) 0);
- while (a_elt || b_elt)
- {
- if (b_elt && kill_elt && kill_elt->indx == b_elt->indx
- && (!a_elt || a_elt->indx >= b_elt->indx));
- else
- {
- bitmap_elt_ior (dst, dst_elt, dst_prev, a_elt, b_elt);
- if (a_elt && b_elt && a_elt->indx == b_elt->indx)
- ;
- else if (a_elt && (!b_elt || a_elt->indx <= b_elt->indx))
- a_elt = a_elt->next;
- }
- }
-}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c
deleted file mode 100644
index 08c0b8d..0000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-thread3-details -fdump-tree-thread4-details -fno-finite-loops --param early-inlining-insns=14 -fno-inline-functions" } */
-/* { dg-final { scan-tree-dump "Registering jump thread" "thread3" } } */
-/* { dg-final { scan-tree-dump "Registering jump thread" "thread4" } } */
-
-typedef struct bitmap_head_def *bitmap;
-typedef const struct bitmap_head_def *const_bitmap;
-typedef struct VEC_int_base
-{
-}
-VEC_int_base;
-typedef struct VEC_int_heap
-{
- VEC_int_base base;
-}
-VEC_int_heap;
-typedef unsigned long BITMAP_WORD;
-typedef struct bitmap_element_def
-{
- struct bitmap_element_def *next;
- unsigned int indx;
-}
-bitmap_element;
-typedef struct bitmap_head_def
-{
-}
-bitmap_head;
-typedef struct
-{
- bitmap_element *elt1;
- bitmap_element *elt2;
- BITMAP_WORD bits;
-}
-bitmap_iterator;
-static __inline__ void
-bmp_iter_and_compl_init (bitmap_iterator * bi, const_bitmap map1,
- const_bitmap map2, unsigned start_bit,
- unsigned *bit_no)
-{
-}
-
-static __inline__ void
-bmp_iter_next (bitmap_iterator * bi, unsigned *bit_no)
-{
-}
-
-static __inline__ unsigned char
-bmp_iter_and_compl (bitmap_iterator * bi, unsigned *bit_no)
-{
- if (bi->bits)
- {
- while (bi->elt2 && bi->elt2->indx < bi->elt1->indx)
- bi->elt2 = bi->elt2->next;
- }
-}
-
-extern int VEC_int_base_length (VEC_int_base *);
-bitmap
-compute_idf (bitmap def_blocks, bitmap_head * dfs)
-{
- bitmap_iterator bi;
- unsigned bb_index, i;
- VEC_int_heap *work_stack;
- bitmap phi_insertion_points;
- while ((VEC_int_base_length (((work_stack) ? &(work_stack)->base : 0))) > 0)
- {
- for (bmp_iter_and_compl_init
- (&(bi), (&dfs[bb_index]), (phi_insertion_points), (0), &(i));
- bmp_iter_and_compl (&(bi), &(i)); bmp_iter_next (&(bi), &(i)))
- {
- }
- }
-}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-backedge.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-backedge.c
new file mode 100644
index 0000000..890a0ee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-backedge.c
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// { dg-options "-O2 -fdisable-tree-ethread -fdisable-tree-thread1 -fdisable-tree-thread2 -fno-tree-dominator-opts -fdump-tree-thread3-details" }
+
+// Test that we can thread jumps across the backedge of a loop through
+// the switch statement to a particular case.
+//
+// Just in case, we disable all the jump threaders before loop
+// optimizations to make sure we get a clean stab at this.
+
+int foo (unsigned int x, int s)
+{
+ while (s != 999)
+ {
+ switch (s)
+ {
+ case 0:
+ if (x)
+ s = 1;
+ break;
+ case 1:
+ if (x)
+ s = 999;
+ break;
+ default:
+ break;
+ }
+ x++;
+ }
+ return s;
+}
+
+// { dg-final { scan-tree-dump "Registering jump thread:.*normal \\(back\\)" "thread3" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-invalid.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-invalid.c
new file mode 100644
index 0000000..bd56a62
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-invalid.c
@@ -0,0 +1,102 @@
+// { dg-do compile }
+// { dg-options "-O2 -fgimple -fdump-statistics" }
+//
+// This is a collection of seemingly threadble paths that should not be allowed.
+
+void foobar (int);
+
+// Possible thread from 2->4->3, but it would rotate the loop.
+void __GIMPLE (ssa)
+f1 ()
+{
+ int i;
+
+ // Pre-header.
+ __BB(2):
+ goto __BB4;
+
+ // Latch.
+ __BB(3):
+ foobar (i_1);
+ i_5 = i_1 + 1;
+ goto __BB4;
+
+ __BB(4,loop_header(1)):
+ i_1 = __PHI (__BB2: 0, __BB3: i_5);
+ if (i_1 != 101)
+ goto __BB3;
+ else
+ goto __BB5;
+
+ __BB(5):
+ return;
+
+}
+
+// Possible thread from 2->3->5 but threading through the empty latch
+// would create a non-empty latch.
+void __GIMPLE (ssa)
+f2 ()
+{
+ int i;
+
+ // Pre-header.
+ __BB(2):
+ goto __BB3;
+
+ __BB(3,loop_header(1)):
+ i_8 = __PHI (__BB5: i_5, __BB2: 0);
+ foobar (i_8);
+ i_5 = i_8 + 1;
+ if (i_5 != 256)
+ goto __BB5;
+ else
+ goto __BB4;
+
+ // Latch.
+ __BB(5):
+ goto __BB3;
+
+ __BB(4):
+ return;
+
+}
+
+// Possible thread from 3->5->6->3 but this would thread through the
+// header but not exit the loop.
+int __GIMPLE (ssa)
+f3 (int a)
+{
+ int i;
+
+ __BB(2):
+ goto __BB6;
+
+ __BB(3):
+ if (i_1 != 0)
+ goto __BB4;
+ else
+ goto __BB5;
+
+ __BB(4):
+ foobar (5);
+ goto __BB5;
+
+ // Latch.
+ __BB(5):
+ i_7 = i_1 + 1;
+ goto __BB6;
+
+ __BB(6,loop_header(1)):
+ i_1 = __PHI (__BB2: 1, __BB5: i_7);
+ if (i_1 <= 99)
+ goto __BB3;
+ else
+ goto __BB7;
+
+ __BB(7):
+ return;
+
+}
+
+// { dg-final { scan-tree-dump-not "Jumps threaded" "statistics" } }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c
index 86d07ef..f3ca140 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp-thread1-details -fdelete-null-pointer-checks" } */
+/* { dg-options "-O2 -fdump-tree-thread1-details -fdelete-null-pointer-checks" } */
/* { dg-skip-if "" keeps_null_pointer_checks } */
void oof (void);
@@ -29,5 +29,5 @@ build_omp_regions_1 (basic_block bb, struct omp_region *parent,
/* ARM Cortex-M defined LOGICAL_OP_NON_SHORT_CIRCUIT to false,
so skip below test. */
-/* { dg-final { scan-tree-dump-times "Threaded" 1 "vrp-thread1" { target { ! arm_cortex_m } } } } */
+/* { dg-final { scan-tree-dump-times "Registering jump thread" 1 "thread1" { target { ! arm_cortex_m } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c
index c2da30b..2c6742b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-fre -fdisable-tree-evrp -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */
+/* { dg-options "-O2 -fno-tree-fre -fdisable-tree-evrp -fdump-tree-vrp1-details -fdisable-tree-thread1 -fdelete-null-pointer-checks" } */
/* Compile with -fno-tree-fre -O2 to prevent CSEing *p. */
int
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp55.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp55.c
index a478a69..0ef57d9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp55.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp55.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp-thread1-blocks-vops-details -fdelete-null-pointer-checks" } */
+/* { dg-options "-O2 -fdump-tree-ethread-details -fdelete-null-pointer-checks" } */
void arf (void);
@@ -12,6 +12,6 @@ fu (char *p, int x)
arf ();
}
-/* { dg-final { scan-tree-dump-times "Threaded jump" 1 "vrp-thread1" { target { ! keeps_null_pointer_checks } } } } */
-/* { dg-final { scan-tree-dump-times "Threaded jump" 0 "vrp-thread1" { target { keeps_null_pointer_checks } } } } */
+/* { dg-final { scan-tree-dump-times "Registering jump thread" 1 "ethread" { target { ! keeps_null_pointer_checks } } } } */
+/* { dg-final { scan-tree-dump-times "Registering jump thread" 0 "ethread" { target { keeps_null_pointer_checks } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp98-1.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp98-1.c
new file mode 100644
index 0000000..daa3f07
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp98-1.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target int128 } */
+/* { dg-options "-Os -fdump-tree-evrp-details" } */
+
+#include <stdint.h>
+#include <limits.h>
+
+typedef unsigned int word __attribute__((mode(word)));
+typedef unsigned __int128 bigger_than_word;
+
+int
+foo (bigger_than_word a, word b, uint8_t c)
+{
+ /* Must fold use of t1 into use of b, as b is no wider than word_mode. */
+ const uint8_t t1 = b % UCHAR_MAX;
+
+ /* Must NOT fold use of t2 into use of a, as a is wider than word_mode. */
+ const uint8_t t2 = a % UCHAR_MAX;
+
+ /* Must fold use of t3 into use of c, as c is narrower than t3. */
+ const uint32_t t3 = (const uint32_t)(c >> 1);
+
+ uint16_t ret = 0;
+
+ if (t1 == 1)
+ ret = 20;
+ else if (t2 == 2)
+ ret = 30;
+ else if (t3 == 3)
+ ret = 40;
+ /* Th extra condition below is necessary to prevent a prior pass from
+ folding away the cast. Ignored in scan-tree-dump. */
+ else if (t3 == 4)
+ ret = 50;
+
+ return ret;
+}
+
+/* { dg-final { scan-tree-dump "Folded into: if \\(_\[0-9\]+ == 1\\)" "evrp" } } */
+/* { dg-final { scan-tree-dump-not "Folded into: if \\(_\[0-9\]+ == 2\\)" "evrp" } } */
+/* { dg-final { scan-tree-dump "Folded into: if \\(_\[0-9\]+ == 3\\)" "evrp" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp98.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp98.c
index 982f091..78d3bba 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp98.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp98.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target int128 } */
-/* { dg-options "-Os -fdump-tree-vrp1-details" } */
+/* { dg-options "-Os -fdisable-tree-evrp -fdump-tree-vrp1-details" } */
#include <stdint.h>
#include <limits.h>
diff --git a/gcc/testsuite/gcc.dg/ubsan/pr81981.c b/gcc/testsuite/gcc.dg/ubsan/pr81981.c
index 8a6597c..d201efb 100644
--- a/gcc/testsuite/gcc.dg/ubsan/pr81981.c
+++ b/gcc/testsuite/gcc.dg/ubsan/pr81981.c
@@ -16,6 +16,6 @@ foo (int i)
u[0] = i;
}
- v = u[0]; /* { dg-warning "may be used uninitialized" } */
+ v = u[0]; /* { dg-warning "may be used uninitialized" "" { xfail *-*-* } } */
return t[0]; /* { dg-warning "may be used uninitialized" } */
}
diff --git a/gcc/testsuite/gcc.dg/uninit-pr89230-1.c b/gcc/testsuite/gcc.dg/uninit-pr89230-1.c
index 1c07c4f..dfc87a5 100644
--- a/gcc/testsuite/gcc.dg/uninit-pr89230-1.c
+++ b/gcc/testsuite/gcc.dg/uninit-pr89230-1.c
@@ -8,7 +8,8 @@ struct S { int i, j; };
int g (void)
{
- struct S *p = f (), *q;
+ struct S *p = f ();
+ struct S *q; // { dg-bogus "may be used uninitialized" "uninitialized" { xfail *-*-* } }
if (p->i || !(q = f ()) || p->j != q->i)
{
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-16.c b/gcc/testsuite/gcc.dg/vect/bb-slp-16.c
index e68a9b6..82fae06 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-16.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-16.c
@@ -1,4 +1,6 @@
/* { dg-require-effective-target vect_int } */
+/* The SLP vectorization happens as part of the if-converted loop body. */
+/* { dg-additional-options "-fdump-tree-vect-details" } */
#include <stdarg.h>
#include "tree-vect.h"
@@ -65,5 +67,4 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" } } */
-
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "vect" } } */