From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A908F3858D1E; Tue, 25 Apr 2023 07:06:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A908F3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682406368; bh=13YS7+oo50nqYUUog6NU9ySxuSa6/DjyPprwKRuEu9k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rzEZ9H5sOO3Z8qkHF7lVAmatbHjIpkw5COh3OnjZmdb+vfXuonaxNaBrhPyHh9MoP c320/ooM8CgsU3mSlynf88eCmJyje8O2JCkMmjavBD7Z6AOD9QhhMd6PFf0VSqjXRn AOi2t6z4CXAxUWEl0G1xWHrI2A5GYTv2PVojXylg= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/109609] [12/13/14 Regression] tail call for function even when passing a ptr which references a local array still Date: Tue, 25 Apr 2023 07:06:08 +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: 12.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D109609 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #10 from Richard Biener --- On the first testcase reverting the offending rev. shows that it causes [local count: 137085152]: - MEM[(char *)&buf + 12B] =3D 0; - _19 =3D *id_8(D); - if (_19 !=3D 0) + _18 =3D *id_7(D); + if (_18 !=3D 0) thus we DSE the store to the end. The issue is that the fnspec we have for strncpy says the access size is specified by argument 3 but what it specified there is the _maximum_ size read, not the actual size. So instead of "1cO313" it should be "1cO31 " ('1' is somewhat odd then, it says we copy 'src' to 'dst' but we only say the 'dst' write covers arg 3 size - I guess that's OK for points-to analysis, the additional zeros written do not have pointers, but if we use it differently it might be a wrong spec?) I'm scanning other builtins for similar issues.=