From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A608C3858C62; Sat, 24 Jun 2023 21:21:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A608C3858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687641694; bh=vmN+mOwDpRReX/VrkqxeGdQvV1jZk6/hyreKr5QUyAs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=u07j8YIbevsEQAaaIoEjSTL9/FRLA6i83LBcdpFSr0QgAi9kQztsedO/Hc1AzZfu/ A/QAvkBbKHmZMgC4opEzlSG7Gmf63aWF6z3T9F7lKKvv4Gz/L9fZUiw1TGxJ86VbHx vwEOk6xO9j+LudiUa/XPJI5oJNX7vY+I10VCvjXY= From: "jackyguo18 at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110394] Lambda capture receives wrong value Date: Sat, 24 Jun 2023 21:21:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jackyguo18 at hotmail dot com X-Bugzilla-Status: WAITING 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=3D110394 --- Comment #5 from jackyguo18 at hotmail dot com --- @Andrew Pinski - Thanks, just confirmed that that was the issue. Why doesn't GCC choose to delete the function (thus causing the weird behaviour) early at lower optimization levels? Seems kinda strange it would work at -O2.=