From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6930E3858D33; Fri, 17 Feb 2023 00:10:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6930E3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676592644; bh=RlGNa24I5VSxQYjoN5AWzEKujY9MGE14ldLXNOjiqWE=; h=From:To:Subject:Date:From; b=D8HRvBZMg0NH4+WBJ0Yy7F37VMgdNSKTtnfFB98hVFbtPYYJI2QDUlu2BNf2lIayj BB0J+NCL4bOJ0VaNg8rr6XsgPFh7z1q5saJL3UqM8Bmys7Ixt3R+GOELd7vgiExXJ5 Eo9DKN1WCs41U3IcTD1yCiOpFmcsIXcktzWY4R7I= From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/108830] New: Excess warnings from -Wanalyzer-null-dereference Date: Fri, 17 Feb 2023 00:10:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dmalcolm at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter blocked target_milestone attachments.created Message-ID: 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=3D108830 Bug ID: 108830 Summary: Excess warnings from -Wanalyzer-null-dereference Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Blocks: 108562 Target Milestone: --- Created attachment 54477 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54477&action=3Dedit Reproducer I see lots of (probable) false positives from the attached on GCC 11 through 13. Trunk: https://godbolt.org/z/nzYreY1zx GCC 12.2: https://godbolt.org/z/zjod5768f GCC 11.3: https://godbolt.org/z/aeevhssG4 After the initial warning: :77:24: warning: dereference of NULL 'new_vals' [CWE-476] [-Wanalyzer-null-dereference] ...we emit 4 further almost identical warnings. I think they're all false positives, due to invariants we can't know about,= but presumably we should only emit the first warning: once we've determined that we're derefing NULL 'new_vals', it doesn't make sense to repeatedly complain each time through the loop (which is what I think is happening). There are also a huge number of spammy "'new_vals' is NULL" messages. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108562 [Bug 108562] [meta-bug] tracker bug for issues with -Wanalyzer-null-derefer= ence=