diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 061634479..2838265eb 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -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; } } diff --git a/test/testcondition.cpp b/test/testcondition.cpp index fea1faebc..974637af0 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -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() {