https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108830

            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=54477&action=edit
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:
  <source>: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=108562
[Bug 108562] [meta-bug] tracker bug for issues with -Wanalyzer-null-dereference

Reply via email to