From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AE1CF3858D3C; Mon, 6 Nov 2023 11:33:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE1CF3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699270412; bh=BJR1dig7m278BxmA1+L4OlpcWuXz5GPvoB846wp4BvY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vy+YS1tvh99KenJipH75hcQ/aIwCw9MGx3woMfdkDvHTMKa1gsr64UNhMznpGufqh 200XrzkEaFDuKe0Xb1+XMGY+mNHjPPdpsSjMTfz1B7DVTtSwq982H5wdnqHNCmgpy4 DY+6ZWARLXL1UK3gyt3ZSqUkfDLQOJX2n0wijWtg= From: "mohamed.selim at dxc dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112350] gcc is not triggering a dangling reference indicating stack use after return with -fsanitize=address and optimization Date: Mon, 06 Nov 2023 11:33:32 +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.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: mohamed.selim at dxc dot com X-Bugzilla-Status: UNCONFIRMED 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=3D112350 --- Comment #2 from Mohamed --- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112350&GoAheadAndLogIn=3D1 it's shown here that the warning is triggered by setting -O3 optimization l= evel to 3.=20 I don't know if such behavior is expected i.e. triggering warning is coupled with optimization level!!! So the above link to compiler explorer example shows only the diagnostic er= ror from the sanitizer, if -O3 is added the warning is triggered.=