Fix #11701 performance regression (hang) in 2.11dev (#5032)

This commit is contained in:
chrchr-github 2023-05-04 11:59:03 +02:00 committed by GitHub
parent 100d17df4f
commit d3bdb84650
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -9218,6 +9218,7 @@ struct ValueFlowPassRunner {
return run(pass);
}))
return true;
--n;
}
if (state.settings->debugwarnings) {
if (n == 0 && values != getTotalValues()) {

View File

@ -7189,6 +7189,23 @@ private:
" }\n"
"}\n";
valueOfTok(code, "i");
code = "void f() {\n" // #11701
" std::vector<int> v(500);\n"
" for (int i = 0; i < 500; i++) {\n"
" if (i < 122)\n"
" v[i] = 255;\n"
" else if (i == 122)\n"
" v[i] = 220;\n"
" else if (i < 386)\n"
" v[i] = 196;\n"
" else if (i == 386)\n"
" v[i] = 118;\n"
" else\n"
" v[i] = 0;\n"
" }\n"
"}\n";
valueOfTok(code, "i");
}
void valueFlowCrashConstructorInitialization() { // #9577