From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8E0883858D28; Thu, 26 Jan 2023 09:56:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E0883858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674726984; bh=UNBfoKIb1ALx7EktGcFw/+OkZIXO1Z3GvmNZ0vv/kdU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rJjHf+iH5ONAfPAi3zkkjo32ZxZjNoWxshJMaLq8JBZh6VgpYjpkmuhnwiA1iJYEb 25W+kyP0ZYGPaO7Pjh2KB2zVDXsqAc1c2vF7YytgFyONHSadQZgMCM4KCTR7TubOaP 91DOq7zVBfrpGYnXG076rweoCbKPXw8+CJL72BkI= From: "fcontact at cuveland dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/108554] Warning "null pointer dereferece" raised when extracting a unique_ptr from a map and any "-O" flag Date: Thu, 26 Jan 2023 09:56:24 +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.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: fcontact at cuveland dot de 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=3D108554 --- Comment #2 from Jan de Cuveland --- Thanks for the insight! Adding a check on empty() for my_map.extract(it) resolves the issue. So it is just that the static analyzer does not see that (to my understandi= ng) "it" has to be a valid iterator and thus will always result in a non-empty = node handle.=