]> git.ipfire.org Git - thirdparty/gcc.git/commit
analyzer: fix deref-before-check false positives due to inlining [PR112790]
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 9 May 2024 17:09:29 +0000 (13:09 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Thu, 9 May 2024 17:09:29 +0000 (13:09 -0400)
commit994477c41049d45b60a4d6db7f624fe5c89860fe
tree7cc2dff408c0ebd6ca494fa947c3630b5cb61419
parenta1cb188cb2ca2ad3f4e837dba2967f323669d36e
analyzer: fix deref-before-check false positives due to inlining [PR112790]

Backported from commit r14-6918-g5743e1899d5964 (moving testcase from
c-c++-common to gcc.dg).

gcc/analyzer/ChangeLog:
PR analyzer/112790
* checker-event.cc (class inlining_info): Move to...
* inlining-iterator.h (class inlining_info): ...here.
* sm-malloc.cc: Include "analyzer/inlining-iterator.h".
(maybe_complain_about_deref_before_check): Reject stmts that were
inlined from another function.

gcc/testsuite/ChangeLog:
PR analyzer/112790
* gcc.dg/analyzer/deref-before-check-pr112790.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/checker-event.cc
gcc/analyzer/inlining-iterator.h
gcc/analyzer/sm-malloc.cc
gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr112790.c [new file with mode: 0644]