[analyzer] Fix for the crash in #56873
authorisuckatcs <65320245+isuckatcs@users.noreply.github.com>
Tue, 2 Aug 2022 09:28:15 +0000 (11:28 +0200)
committerisuckatcs <65320245+isuckatcs@users.noreply.github.com>
Wed, 3 Aug 2022 17:25:02 +0000 (19:25 +0200)
commit10a7ee0bac211810376f29a879a9f73ed2ab15fc
treeacb897215320eb2599cb09bd1089e63cc980ea12
parent3426fc7318fe555ee37db14525e9bf024760fde2
[analyzer] Fix for the crash in #56873

In ExprEngine::bindReturnValue() we cast an SVal to DefinedOrUnknownSVal,
however this SVal can also be Undefined, which leads to an assertion failure.

Fixes: #56873

Differential Revision: https://reviews.llvm.org/D130974
clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
clang/test/Analysis/Issue56873.cpp [new file with mode: 0644]