From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B158C3858C83; Mon, 27 Mar 2023 13:00:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B158C3858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679922052; bh=sahXEXV16N3Atxkhc7ak/JKDawUeZscs6iPcRjB3DP8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DVOoaB9raa75OudCeZFGIopqgHbleEIskt3UVs8LQtVoq9+EDXurtfg4JDOBhA+zQ sX5Zmz5qDMuXPwCeK0x6NBKKOOT9TGcQmhPP6JQdhXJ28JZAtIv2gQ6RTQ7Xj+VpLC phX0VtFe2pctXBPh1mxYPbHdmKLM9n/jhG0UX4hM= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107087] [13 Regression] bits/stl_algobase.h:431: warning: 'void* __builtin_memcpy(void*, const void*, unsigned int)' reading between 8 and 2147483644 bytes from a region of size 4 [-Wstringop-overread] Date: Mon, 27 Mar 2023 13:00:51 +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: 13.0 X-Bugzilla-Keywords: diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords assigned_to bug_status 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=3D107087 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org Status|NEW |ASSIGNED --- Comment #2 from Richard Biener --- Huh. [local count: 226234232]: _634 =3D _76 + _546; _618 =3D -12; if (_618 > 4) goto ; [90.00%] else goto ; [10.00%] left around by t.ii.204t.forwprop4 _634 =3D _76 + _546; - _618 =3D 8 - prephitmp_260; + _618 =3D -12; if (_618 > 4) and this constant is produced by cleanup_cfg via replace_uses_by which replaces prephitmp_260 with 20 and folds the stmt when merging blocks 30 and 36. If we'd realize the condition would be false we wouldn't emit the bad diagnostics. Note it's the very last forwprop and there's no copy propagation done afterwards. IMHO even CFG cleanup propagating to uses instead of replacing the PHI with a copy is premature, so asking for it to propagate even further there is wrong I think. forwprop could eventually be taught to track known not executable edges in its non-iterating RPO walk and so eventually optimize the copy itself. The testcase has no loops at least. Let me try.=