From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D7C0D3858412; Mon, 14 Feb 2022 15:38:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7C0D3858412 From: "tnfchris at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94294] [missed optimization] new+delete of unused local string not removed Date: Mon, 14 Feb 2022 15:38:15 +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: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: tnfchris at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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 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: Mon, 14 Feb 2022 15:38:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94294 Tamar Christina changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tnfchris at gcc dot gnu.org --- Comment #5 from Tamar Christina --- (In reply to Marc Glisse from comment #4) > I don't believe there is a "new/delete" issue. I wonder.. , looking at #include #include #include struct param { uint32_t k; std::vector src; std::vector ref0; }; size_t foo() { param test[] =3D { {48, {255, 0, 0, 0, 0, 0} }}; return sizeof(test); } I had expected the answer to simply be mov w0, #56 ret since the new and delete can be elided. ...but GCC generates some pretty bad code here...=20 https://godbolt.org/z/EPoYYohPa In this case nothing of the structure is used at all yet we keep all the construction code.=