New warning: -Wanalyzer-jump-through-null [PR105947]
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 5 Aug 2022 23:45:41 +0000 (19:45 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 5 Aug 2022 23:45:41 +0000 (19:45 -0400)
commite1a9168153d2bf12695844a9ca9f9fc1de8d1ddf
tree1ec0493d1273a4b4e8abaf2ee23d13be64ffffc9
parentcc01a27db5411a4fe354a97b7c86703c5bc81243
New warning: -Wanalyzer-jump-through-null [PR105947]

This patch adds a new warning to -fanalyzer for jumps through NULL
function pointers.

gcc/analyzer/ChangeLog:
PR analyzer/105947
* analyzer.opt (Wanalyzer-jump-through-null): New option.
* engine.cc (class jump_through_null): New.
(exploded_graph::process_node): Complain about jumps through NULL
function pointers.

gcc/ChangeLog:
PR analyzer/105947
* doc/invoke.texi: Add -Wanalyzer-jump-through-null.

gcc/testsuite/ChangeLog:
PR analyzer/105947
* gcc.dg/analyzer/function-ptr-5.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/analyzer.opt
gcc/analyzer/engine.cc
gcc/doc/invoke.texi
gcc/testsuite/gcc.dg/analyzer/function-ptr-5.c [new file with mode: 0644]