Fixed #5657 (false positive: (error) Possible null pointer dereference: p)
This commit is contained in:
parent
3300d39854
commit
1233d8e47f
|
@ -723,7 +723,7 @@ static void execute(const Token *expr,
|
|||
|
||||
else if (expr->str() == "=") {
|
||||
execute(expr->astOperand2(), programMemory, result, error);
|
||||
if (expr->astOperand1() && expr->astOperand1()->varId())
|
||||
if (!*error && expr->astOperand1() && expr->astOperand1()->varId())
|
||||
(*programMemory)[expr->astOperand1()->varId()] = *result;
|
||||
else
|
||||
*error = true;
|
||||
|
|
|
@ -743,6 +743,13 @@ private:
|
|||
" 0 : a[x];\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 4U, 0));
|
||||
|
||||
code = "void f() {\n"
|
||||
" int x;\n"
|
||||
" for (int i = 0; x = bar[i]; i++)\n"
|
||||
" x;\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 4U, 0));
|
||||
}
|
||||
|
||||
void valueFlowSubFunction() {
|
||||
|
|
Loading…
Reference in New Issue