Reverted f088588c fix for #6187 that fixes infinite loop, the fix cause a use-after-free regression.

This commit is contained in:
Daniel Marjamäki 2014-10-16 06:32:06 +02:00
parent ab6178f739
commit ecd17d84fb
2 changed files with 2 additions and 11 deletions

View File

@ -9091,7 +9091,8 @@ void Tokenizer::simplifyWhile0()
if (Token::simpleMatch(tok->next()->link(), ") {")) { if (Token::simpleMatch(tok->next()->link(), ") {")) {
Token *end = tok->next()->link(); Token *end = tok->next()->link();
end = end->next()->link(); end = end->next()->link();
eraseDeadCode(tok->previous(), end->next()); tok = tok->previous();
eraseDeadCode(tok, end->next());
} }
} }
} }

View File

@ -2375,16 +2375,6 @@ private:
ASSERT_EQUALS("void foo ( ) { exit ( 0 ) ; }", ASSERT_EQUALS("void foo ( ) { exit ( 0 ) ; }",
tokWithStdLib("void foo() { do { exit(0); } while (true); }")); tokWithStdLib("void foo() { do { exit(0); } while (true); }"));
// #6187
tokWithStdLib("void foo() {\n"
" goto label;\n"
" for (int i = 0; i < 0; ++i) {\n"
" ;\n"
"label:\n"
" ;\n"
" }\n"
"}");
} }
void strcat1() { void strcat1() {