From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E58A9385C32E; Thu, 23 Nov 2023 15:10:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E58A9385C32E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700752203; bh=pndMLEeIOGOEu37aFzfEZ+YBbgoeMrpUG3UHwNyxozM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=W1myJdqS9OKUP8m/YgYpRK7gfbz8T9zyMBrKCUOSCJGTtjhtIbT5xYkN3hXSFtgTU 98lGYHqpbRn3bjlfzAd1z8WUCDHjLiKxnKQpAiLmspWgqXngXwXGEXWenzR+wqF+U2 pZkyKfqATf0f2iqFJtgS7b+rNpgsBHVjPP6muxmA= From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/112653] PTA should handle correctly escape information of values returned by a function Date: Thu, 23 Nov 2023 15:10:02 +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: unknown X-Bugzilla-Keywords: alias, missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: hubicka 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: 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=3D112653 --- Comment #7 from Jan Hubicka --- Thanks for explanation. I think it is quite common pattern that new object= is construted and worked on and later returned, so I think we ought to handle = this correctly. Another example just came up in https://gcc.gnu.org/pipermail/gcc-patches/2023-November/637878.html We should gnerate same code for the following two functions: #include auto f() { std::vector x; x.reserve(10); for (int i =3D 0; i < 10; ++i) x.push_back(0); return x; } auto g() { return std::vector(10, 0); } but we don't since we lose track of values stored in x after every call to = new.=