Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement (#4625)
* Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement * Format
This commit is contained in:
parent
c779cefa61
commit
c150317f02
|
@ -6070,7 +6070,7 @@ struct ConditionHandler {
|
|||
});
|
||||
for (Token* start:nextExprs) {
|
||||
Analyzer::Result r = forward(start, cond.vartok, values, tokenlist);
|
||||
if (r.terminate != Analyzer::Terminate::None)
|
||||
if (r.terminate != Analyzer::Terminate::None || r.action.isModified())
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4640,6 +4640,13 @@ private:
|
|||
" if (i == j) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #11384
|
||||
check("bool f(const int* it, const int* end) {\n"
|
||||
" return (it != end) && *it++ &&\n"
|
||||
" (it != end) && *it;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void alwaysTrueInfer() {
|
||||
|
|
Loading…
Reference in New Issue