From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id BCAE3385515F; Sat, 3 Dec 2022 10:05:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BCAE3385515F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x62f.google.com with SMTP id vv4so16834110ejc.2; Sat, 03 Dec 2022 02:05:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=E2ZEPMbWJTHf/uFklYZvqa28BerDihkemrjBnGSqUeQ=; b=O90wQTPEWkCp8fBdV/Kv3NqY2G62D1H1p2iuuvSPE5Lq0XP3CU+FYy2U4nhNjvb6Y+ 552EmkXg8b8qiQ+8SLddlZZke3garPttwddhzETWqEDTrzAvtkmVSuzJQ0m5ZL9y63WH WM6HtsZidVp5r7BGmopbYQEAmqC3qJNG/7Ndh/fYxXwJZnRsYW1hoOHqUWwyNRt5VFPK 8bK+lzEN4ob49PY1QSmzeghAhTn8Rcd1btPXHuhBjOhVJQFUKByuJjuy71hDFxxviDDR 0rB9NaOUHK0oehG+JWEAe/r8ox8i27xYYJWLQ1WjC2iVSZq2RIUmjfsJawEvGw+HPIUs TROg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E2ZEPMbWJTHf/uFklYZvqa28BerDihkemrjBnGSqUeQ=; b=mhqmL28F5ingfm+03Lv98xmkruoZMFbvdHYMoKKDrKfzRWw9Qw0Z9ktgTrxR0jZWaU L+V2E0/CbO4WFe8bse61mbhrkJdUJ7lVk8JkjiwP1pfVQQVYUP7fYxvGaeg/eATEhDDl BxS99n8wFuGIdQs7PgiyjL37qWbeog5PBgaQ0YzBbTEQXYfapkP029CEU3QsWpFIh94X Lf3mRPwOSH5tLD4jO87pqG8Ieu7uTat5KANm+t9sjVYF7veO5myukFB5SvIfmASDHnUm bNXyNsyXIfZA55urHknMtbh8grZ3Q8mwA4u4ud/lmM+H/aVI9nwkMCQp6o2HH5Qxzsqi uPhA== X-Gm-Message-State: ANoB5pk1FeR5hpgfJCooZKjGy9PMjHN6Wtwg9A8lOEpZPYocjZwwHvsQ BdQFpotfbJdenxzuOvMsmMo= X-Google-Smtp-Source: AA0mqf46qHU2QpTUpAC7SKyggTDWpOICMbINMSsf54itg8SOsXdj1ws9TGfAEghLiDX/mRtlaE5yTg== X-Received: by 2002:a17:906:c259:b0:7b5:9670:ae0 with SMTP id bl25-20020a170906c25900b007b596700ae0mr48679419ejb.321.1670061904262; Sat, 03 Dec 2022 02:05:04 -0800 (PST) Received: from smtpclient.apple (dynamic-077-007-055-019.77.7.pool.telefonica.de. [77.7.55.19]) by smtp.gmail.com with ESMTPSA id i15-20020a170906264f00b007aa239cf4d9sm4012103ejc.89.2022.12.03.02.05.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 03 Dec 2022 02:05:02 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] [PR102706] [testsuite] -Wno-stringop-overflow vs Warray-bounds Date: Sat, 3 Dec 2022 11:04:52 +0100 Message-Id: <01D2C372-75C9-48AE-8547-240D30895291@gmail.com> References: Cc: gcc-patches@gcc.gnu.org, Rainer Orth , Mike Stump , Martin Sebor , Hongtao Liu , Kewen Lin In-Reply-To: To: Alexandre Oliva X-Mailer: iPhone Mail (20B110) X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Am 03.12.2022 um 09:16 schrieb Alexandre Oliva via Gcc-patches : >=20 > =EF=BB=BF > 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. >=20 > On riscv64-elf and arm-eabi/-mcpu=3Dcortex-r5, for example, though the > Warray-bounds-48.c condition passes, we don't issue warnings because > we decide not to vectorize the assignments. >=20 > 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=3Dcortex-r5, the condition passes so we'd expect the > warning in both functions, but we don't warn on either. >=20 > 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. >=20 > Regstrapping on x86_64-linux-gnu, also tested with crosses to > riscv64-elf and arm-eabi. Ok to install? If it=E2=80=99s cost can you try-fno-vect-cost-model? If that works it might= be better? Otherwise OK. Richard=20 >=20 > for gcc/testsuite/ChangeLog >=20 > PR tree-optimization/102706 > * gcc.dg/Warray-bounds-48.c: Disable -Wstringop-overflow. > * gcc.dg/Wzero-length-array-bounds-2.c: Likewise. > --- > 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(-) >=20 > diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-48.c b/gcc/testsuite/gcc.d= g/Warray-bounds-48.c > index 775b301e37537..e9203140a274a 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 } */ >=20 > +/* pr102706: disabled warnings because the now-disabled conditions for th= e > + bogus warnings to come up do not take cost analysis into account, and o= ften > + come up wrong. */ > +/* { dg-additional-options "-Wno-stringop-overflow" } */ > + > typedef __INT16_TYPE__ int16_t; > typedef __INT32_TYPE__ int32_t; >=20 > @@ -30,7 +35,8 @@ static void nowarn_ax_extern (struct AX *p) >=20 > static void warn_ax_local_buf (struct AX *p) > { > - p->ax[0] =3D 4; p->ax[1] =3D 5; // { dg-warning "\\\[-Wstringop-overfl= ow" "pr102706" { target { vect_slp_v2hi_store_align && { ! vect_slp_v4hi_st= ore_unalign } } } } > + p->ax[0] =3D 4; p->ax[1] =3D 5; // { dg-bogus "\\\[-Wstringop-overflow= " "pr102706" } > + // { xfail { vect_slp_v2hi_store_align &= & { ! vect_slp_v4hi_store_unalign } } } >=20 > p->ax[2] =3D 6; // { dg-warning "\\\[-Warray-bounds" } > p->ax[3] =3D 7; // { dg-warning "\\\[-Warray-bounds" } > @@ -130,7 +136,8 @@ static void warn_a0_extern (struct A0 *p) >=20 > static void warn_a0_local_buf (struct A0 *p) > { > - p->a0[0] =3D 4; p->a0[1] =3D 5; // { dg-warning "\\\[-Wstringop-overfl= ow" "pr102706" { target { vect_slp_v2hi_store_align && { ! vect_slp_v4hi_sto= re_unalign } } } } > + p->a0[0] =3D 4; p->a0[1] =3D 5; // { dg-bogus "\\\[-Wstringop-overflow= " "pr102706" } > + // { xfail { vect_slp_v2hi_store_align &= & { ! vect_slp_v4hi_store_unalign } } } >=20 > p->a0[2] =3D 6; // { dg-warning "\\\[-Warray-bounds" } > p->a0[3] =3D 7; // { dg-warning "\\\[-Warray-bounds" } > diff --git a/gcc/testsuite/gcc.dg/Wzero-length-array-bounds-2.c b/gcc/test= suite/gcc.dg/Wzero-length-array-bounds-2.c > index 2ef5ccd564ac4..19932d05a315f 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" } */ >=20 > +/* pr102706: disabled warnings because the now-disabled conditions for th= e > + bogus warnings to come up do not take cost analysis into account, and o= ften > + come up wrong. */ > +/* { dg-additional-options "-Wno-stringop-overflow" } */ > + > void sink (void*); >=20 > struct A { int i; }; > @@ -87,7 +92,8 @@ void test_C_global_buf (void) > p->b1.a[ 1].i =3D 0; // { dg-warning "\\\[-Wzero-length-bounds" } > sink (p); >=20 > - p->b2.a[ 0].i =3D 0; // { dg-warning "\\\[-Wstringop-overflow" "pr10= 2706" { target { vect_slp_v2si_store_align && { ! vect_slp_v4si_store_unali= gn } } } } > + p->b2.a[ 0].i =3D 0; // { dg-bogus "\\\[-Wstringop-overflow" "pr1027= 06" } > + // { xfail { vect_slp_v2si_store_align && { ! v= ect_slp_v4si_store_unalign } } } > p->b2.a[ 1].i =3D 0; > p->b2.a[ 2].i =3D 0; // { dg-warning "\\\[-Warray-bounds" } > p->b2.a[ 3].i =3D 0; // { dg-warning "\\\[-Warray-bounds" } > @@ -117,7 +123,8 @@ void test_C_local_buf (void) > p->b1.a[ 1].i =3D 8; // { dg-warning "\\\[-Wzero-length-bounds" } > sink (p); >=20 > - p->b2.a[ 0].i =3D 9; > + p->b2.a[ 0].i =3D 9; // { dg-bogus "\\\[-Wstringop-overflow" "pr1027= 06" } > + // { xfail { vect_slp_v2si_store_align && { ! v= ect_slp_v4si_store_unalign } } } > p->b2.a[ 1].i =3D 10; > p->b2.a[ 2].i =3D 11; // { dg-warning "\\\[-Warray-bounds" } > p->b2.a[ 3].i =3D 12; // { dg-warning "\\\[-Warray-bounds" } >=20 > --=20 > Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ > Free Software Activist GNU Toolchain Engineer > Disinformation flourishes because many people care deeply about injustice > but very few check the facts. Ask me about