From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 2BCE938582A4; Sat, 3 Dec 2022 07:33:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BCE938582A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670052799; bh=xQW5yzdTP8mUXx1etqDBJdXxeKz3YkXcpeHKvrHj0Hw=; h=From:To:Subject:Date:From; b=sqmtOoXxpSs0iRgtBCYp0MQnIScqdY6Gx3tNJcDsXcqwWWWA5H157PA3Hc1vPd3EC azKiXqwk4nLvBaw8gthqCtw07EVgAuRCRYv7huu7En/F3jMORcufIrX2nMdQHZeghN fzfkxZ6t3uONxzL2P097GShvpmINgCr6HhSaPWig= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] [PR102706] [testsuite] -Wno-stringop-overflow vs Warray-bounds X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: c14b8bdf0f5f7def33b33014ac149ac425eb6ea5 X-Git-Newrev: db86e43e7ca1be9d5cce3aaa839fc6a3c6109972 Message-Id: <20221203073319.2BCE938582A4@sourceware.org> Date: Sat, 3 Dec 2022 07:33:19 +0000 (GMT) List-Id: https://gcc.gnu.org/g:db86e43e7ca1be9d5cce3aaa839fc6a3c6109972 commit db86e43e7ca1be9d5cce3aaa839fc6a3c6109972 Author: Alexandre Oliva Date: Sat Dec 3 04:31:20 2022 -0300 [PR102706] [testsuite] -Wno-stringop-overflow vs Warray-bounds The bogus Wstringop-overflow warnings conditionally issued for Warray-bounds-48.c and -Wzero-length-array-bounds-2.c are expected under conditions that depend on the availability of certain vector patterns, but that don't take cost analysis into account, which leads to omitted expected warnings and to unexpected warnings. On riscv64-elf and arm-eabi/-mcpu=cortex-r5, for example, though the Warray-bounds-48.c condition passes, we don't issue warnings because we decide not to vectorize the assignments. On riscv64, for Wzero-length-array-bounds-2.c, we issue the expected warning in test_C_global_buf, but we also issue a warning for test_C_local_buf under the same conditions, that would be expected on other platforms but that is not issued on them. On arm-eabi/-mcpu=cortex-r5, the condition passes so we'd expect the warning in both functions, but we don't warn on either. Instead of further extending the effective target tests, introduced to temporarily tolerate these expected bogus warnings, so as to capture the cost analyses that lead to the mismatched decisions, I'm disabling the undesired warnings for these two tests. for gcc/testsuite/ChangeLog PR tree-optimization/102706 * gcc.dg/Warray-bounds-48.c: Disable -Wstringop-overflow. * gcc.dg/Wzero-length-array-bounds-2.c: Likewise. Diff: --- gcc/testsuite/gcc.dg/Warray-bounds-48.c | 11 +++++++++-- gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2.c | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-48.c b/gcc/testsuite/gcc.dg/Warray-bounds-48.c index 775b301e375..e9203140a27 100644 --- a/gcc/testsuite/gcc.dg/Warray-bounds-48.c +++ b/gcc/testsuite/gcc.dg/Warray-bounds-48.c @@ -4,6 +4,11 @@ { dg-options "-O2 -Wall" } { dg-require-effective-target alloca } */ +/* pr102706: disabled warnings because the now-disabled conditions for the + bogus warnings to come up do not take cost analysis into account, and often + come up wrong. */ +/* { dg-additional-options "-Wno-stringop-overflow" } */ + typedef __INT16_TYPE__ int16_t; typedef __INT32_TYPE__ int32_t; @@ -30,7 +35,8 @@ 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; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v2hi_store_align && { ! vect_slp_v4hi_store_unalign } } } } + p->ax[0] = 4; p->ax[1] = 5; // { dg-bogus "\\\[-Wstringop-overflow" "pr102706" } + // { xfail { vect_slp_v2hi_store_align && { ! vect_slp_v4hi_store_unalign } } } p->ax[2] = 6; // { dg-warning "\\\[-Warray-bounds" } p->ax[3] = 7; // { dg-warning "\\\[-Warray-bounds" } @@ -130,7 +136,8 @@ 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; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v2hi_store_align && { ! vect_slp_v4hi_store_unalign } } } } + p->a0[0] = 4; p->a0[1] = 5; // { dg-bogus "\\\[-Wstringop-overflow" "pr102706" } + // { xfail { vect_slp_v2hi_store_align && { ! vect_slp_v4hi_store_unalign } } } p->a0[2] = 6; // { dg-warning "\\\[-Warray-bounds" } p->a0[3] = 7; // { dg-warning "\\\[-Warray-bounds" } 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 2ef5ccd564a..19932d05a31 100644 --- a/gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2.c +++ b/gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2.c @@ -4,6 +4,11 @@ { dg-do compile } { dg-options "-O2 -Wall" } */ +/* pr102706: disabled warnings because the now-disabled conditions for the + bogus warnings to come up do not take cost analysis into account, and often + come up wrong. */ +/* { dg-additional-options "-Wno-stringop-overflow" } */ + void sink (void*); struct A { int i; }; @@ -87,7 +92,8 @@ 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; // { dg-warning "\\\[-Wstringop-overflow" "pr102706" { target { vect_slp_v2si_store_align && { ! vect_slp_v4si_store_unalign } } } } + p->b2.a[ 0].i = 0; // { dg-bogus "\\\[-Wstringop-overflow" "pr102706" } + // { xfail { vect_slp_v2si_store_align && { ! vect_slp_v4si_store_unalign } } } 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" } @@ -117,7 +123,8 @@ void test_C_local_buf (void) p->b1.a[ 1].i = 8; // { dg-warning "\\\[-Wzero-length-bounds" } sink (p); - p->b2.a[ 0].i = 9; + p->b2.a[ 0].i = 9; // { dg-bogus "\\\[-Wstringop-overflow" "pr102706" } + // { xfail { vect_slp_v2si_store_align && { ! vect_slp_v4si_store_unalign } } } p->b2.a[ 1].i = 10; p->b2.a[ 2].i = 11; // { dg-warning "\\\[-Warray-bounds" } p->b2.a[ 3].i = 12; // { dg-warning "\\\[-Warray-bounds" }