From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 48F513858C74; Thu, 2 Feb 2023 22:06:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48F513858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675375594; bh=sPTezF9ldsfNOXFO76ZMdNlEtDdjVdM9b34w3kscJ7s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wU0N4WeAtSyveJ2iLJ+X/NRoRSb6ncQImJKxpNlB3gOD27zOacytHzPeki10Ul5u5 dql4v4VAKTtHtFIUdqOTYtTuA1HSu6NBxCIprZ2TFm0DBqbtisR7E27sMnryy9oDbo RP69avoEW2BuGdUxoKyV0KjFACxhPzSdhIhHC71E= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/108637] ASAN at -O2 misses a stack-use-after-scope Date: Thu, 02 Feb 2023 22:06:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: shaohua.li at inf dot ethz.ch 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: resolution 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=3D108637 Li Shaohua changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |--- Status|RESOLVED |UNCONFIRMED --- Comment #3 from Li Shaohua --- (In reply to Li Shaohua from comment #2) > (In reply to Andrew Pinski from comment #1) > > PRE removes the load/stores from/to *f . > > Basically the compiler is able to remove the use-after-scope usage with= -O2 > > and above. >=20 > Well, this makes sense to me while in this case only -O2 not other opt > levels did not report this use-after-scope usage. I looked into this again and found that for GCC-12, it was indeed the case.= But for the trunk, I indeed observed that PRE did not optimize away load/store. Compiler explorer: https://godbolt.org/z/sb658P1cM=