analyzer: fix state explosion on va_arg [PR106413]
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 22 Jul 2022 23:50:54 +0000 (19:50 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 22 Jul 2022 23:50:54 +0000 (19:50 -0400)
commit6d5194a10dc103031b9c8a03091ca70f6db33c8b
tree13312753ee87ece630b4ec85ad46a70a0e58731d
parent0fb35a45a28c674d5d420528f7dec629e42b4850
analyzer: fix state explosion on va_arg [PR106413]

Fix state explosion on va_arg when the call to va_start is in the
top-level function of the analysis.

gcc/analyzer/ChangeLog:
PR analyzer/106413
* varargs.cc (region_model::impl_call_va_start): Avoid iterating
through non-existant variadic arguments by initializing the
impl_region to "UNKNOWN" if the va_start occurs in the top-level
function to the analysis.

gcc/testsuite/ChangeLog:
PR analyzer/106413
* gcc.dg/analyzer/torture/stdarg-4.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/varargs.cc
gcc/testsuite/gcc.dg/analyzer/torture/stdarg-4.c [new file with mode: 0644]