From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 768773947438; Tue, 2 Mar 2021 10:50:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 768773947438 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/95757] [11 regression] missing warning in gcc.dg/Wstringop-overflow-25.c since r11-1517 Date: Tue, 02 Mar 2021 10:49:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Mar 2021 10:50:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95757 --- Comment #10 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:ff92ede8d269375f800e1b347a48f4698874b4a3 commit r11-7448-gff92ede8d269375f800e1b347a48f4698874b4a3 Author: Jakub Jelinek Date: Tue Mar 2 11:49:12 2021 +0100 vrp: Improve register_edge_assert_for [PR95757] The Wstringop-overflow-25.c testcase doesn't emit one of the expected warnings on targets that don't do short curcuiting due to target costs (or e.g. with --param=3Dlogical-op-non-short-circuit=3D0 on all targets= ). The problem is that only reassoc2 optimizes: _49 =3D{v} unsigned_value_source; if (_49 =3D=3D 0) goto ; [50.00%] else goto ; [50.00%] [local count: 536870913]: if (_49 > 2) goto ; [50.00%] else goto ; [50.00%] [local count: 268435457]: _53 =3D _49 + 1; into: _49 =3D{v} unsigned_value_source; _48 =3D _49 + 18446744073709551615; _1 =3D _48 > 1; if (_1 !=3D 0) goto ; [50.00%] else goto ; [50.00%] [local count: 268435457]: _53 =3D _49 + 1; (but, note the _1 =3D _48 > 1; if (_1 !=3D 0)), then dom3 is run and because of that if (_1 !=3D 0) vs. if (_48 > 1) do= esn't register edge asserts for _48 and _49) and so we don't get SSA_NAME_RANGE_INFO for _53 (and ditto for vrp2) and only afterwards co= mes forwprop4 that canonicalizes it to if (_48 > 1). While with --param=3Dlogical-op-non-short-circuit=3D1 it is already reassoc1 that optimizes it and forwprop3 that propagates it, so we have on the SSA_NAME corresponding to _53 above SSA_NAME_RANGE_INFO and during expansion we warn. The following patch fixes it by handling those not yet propagated comparisons into GIMPLE_COND in register_edge_assert_for. We already have all the infrastructure there to handle the --param=3Dlogical-op-non-short-circuit=3D1 | and &s. 2021-03-02 Jakub Jelinek PR middle-end/95757 * tree-vrp.c (register_edge_assert_for): Remove superfluous ()s around condition. Call register_edge_assert_for_1 for =3D=3D 0, !=3D = 0, =3D=3D 1 and !=3D 1 comparisons if name is lhs of a comparison.=