analyzer: fix ICE on zero-arg calls passed to __attribute__((nonnull)) [PR 99906]
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 5 Apr 2021 14:51:46 +0000 (10:51 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 5 Apr 2021 14:51:46 +0000 (10:51 -0400)
commit7d8f4240c94e2e7643ac13cda1fdd0bb6ca3a3fb
tree677b9b95da3c33c922a3c26ddfba0c2e2e131ebd
parent69b66ff02353a87585329bb3cf4ac20d6dee1b16
analyzer: fix ICE on zero-arg calls passed to __attribute__((nonnull)) [PR 99906]

gcc/analyzer/ChangeLog:
PR analyzer/99906
* analyzer.cc (maybe_reconstruct_from_def_stmt): Fix NULL
dereference on calls with zero arguments.
* sm-malloc.cc (malloc_state_machine::on_stmt): When handling
__attribute__((nonnull)), only call get_diagnostic_tree if the
result will be used.

gcc/testsuite/ChangeLog:
PR analyzer/99906
* gcc.dg/analyzer/pr99906.c: New test.
gcc/analyzer/analyzer.cc
gcc/analyzer/sm-malloc.cc
gcc/testsuite/gcc.dg/analyzer/pr99906.c [new file with mode: 0644]