From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 46ADE3858D37; Thu, 20 Apr 2023 11:19:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 46ADE3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681989577; bh=k2e3nxp5Y/KUu/H3cJXU4v39ZTrcjJpotSb/hfkkvjA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=a2vBohEvESwE03CDXG1V3Tm5yXk/8x7iXxZ8upM2GEW+7EEf4k56+IasN2soQJ17T orc1fg11ir803VDi7sY4Gitd1HMHVbFy69gZdlN4+3jivPp+VW1xYzs5UwpR+yTXEv tL+ZsAQ19bZYLUwfH4K4C7jXT3OzmKaoBYgxJOwQ= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109568] [12/13/14 Regression] Spurious "potential null pointer dereference" in shared_ptr_base.h with "-O1" Date: Thu, 20 Apr 2023 11:19:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org 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: 12.3 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=3D109568 --- Comment #4 from Jakub Jelinek --- (In reply to zed.three from comment #3) > But should the warning not be on the `var_ref->empty()` call itself then, > instead of inside `shared_ptr::operator=3D=3D`? I guess that it's ultimat= ely > triggered by the implicit `this` in accessing `_M_ptr`, but it would be m= ore > obvious it it were bubbled up to `var_ref` The method is inlined and the warning is diagnosed only after that happens,= so it diagnoses it on the actual (potential, it isn't unconditional) null poin= ter dereference it sees at that point.=