From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8CA39385840A; Wed, 11 Oct 2023 07:23:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CA39385840A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697009026; bh=0alK9ICCQ/UuWGzilS3ziecb9kYjEvzFGsms8fD/MjQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hLmZcDqkcynzGB2P4Z6wLCKlfGES1TNlhMTdxlKwfytBWIct8Ss6sr5/AStL2Jtn3 6+eFhFnRjUrkuriEHOGOlIw3cooeUCAv0bvvN2qIZz8AmTPL5oDyl91rUzzOh+P0r0 /AnnF/P0skIZ7XXCnk0HqJQlrvK1GbG8Yh4CCZLU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111519] [13/14 Regression] Wrong code at -O3 on x86_64-linux-gnu since r13-455-g1fe04c497d Date: Wed, 11 Oct 2023 07:23:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111519 --- Comment #10 from CVS Commits --- The releases/gcc-13 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:16a4df27436c8f594a784028591dd3e47cabe5c0 commit r13-7944-g16a4df27436c8f594a784028591dd3e47cabe5c0 Author: Jakub Jelinek Date: Wed Oct 11 08:58:29 2023 +0200 tree-ssa-strlen: optimization skips clobbering store [PR111519] The following testcase is miscompiled, because count_nonzero_bytes incorrectly uses get_strinfo information on a pointer from which an earlier instruc= tion loads SSA_NAME stored at the current instruction. get_strinfo shows a state right before the current store though, so if there are some stores in between the current store and the load, the string length information might have changed. The patch passes around gimple_vuse from the store and punts instead of using strinfo on loads from MEM_REF which have different gimple_vuse from tha= t. 2023-10-11 Richard Biener Jakub Jelinek PR tree-optimization/111519 * tree-ssa-strlen.cc (strlen_pass::count_nonzero_bytes): Add vu= se argument and pass it through to recursive calls and count_nonzero_bytes_addr calls. Don't shadow the stmt argument, but change stmt for gimple_assign_single_p statements for which we don't immediately punt. (strlen_pass::count_nonzero_bytes_addr): Add vuse argument and = pass it through to recursive calls and count_nonzero_bytes calls. D= on't use get_strinfo if gimple_vuse (stmt) is different from vuse.=20 Don't shadow the stmt argument. * gcc.dg/torture/pr111519.c: New testcase. (cherry picked from commit e75bf1985fdc9a5d3a307882a9251d8fd6e93def)=