analyzer: fix -Wanalyzer-va-list-exhausted false +ve on va_arg in subroutine [PR106383]
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 21 Jul 2022 21:29:26 +0000 (17:29 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Thu, 21 Jul 2022 21:29:26 +0000 (17:29 -0400)
commitb852aa7f265424c8e2036899da5d8306ff06a16c
treec9bf07d3bf2e5a51b28c6202fd086a0a45fa1978
parent633e9920589ddfaf2d6da1c24ce99b18a2638db4
analyzer: fix -Wanalyzer-va-list-exhausted false +ve on va_arg in subroutine [PR106383]

gcc/analyzer/ChangeLog:
PR analyzer/106383
* varargs.cc (region_model::impl_call_va_arg): When determining if
we're doing interprocedural analysis, use the stack depth of the
frame in which va_start was called, rather than the current stack
depth.

gcc/testsuite/ChangeLog:
PR analyzer/106383
* gcc.dg/analyzer/stdarg-3.c: New test.

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