From ecd17d84fb0fd6c2a472c24c552446cc252d0f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 16 Oct 2014 06:32:06 +0200 Subject: [PATCH] Reverted f088588c fix for #6187 that fixes infinite loop, the fix cause a use-after-free regression. --- lib/tokenize.cpp | 3 ++- test/testsimplifytokens.cpp | 10 ---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index b7666aecd..a17040fbc 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -9091,7 +9091,8 @@ void Tokenizer::simplifyWhile0() if (Token::simpleMatch(tok->next()->link(), ") {")) { Token *end = tok->next()->link(); end = end->next()->link(); - eraseDeadCode(tok->previous(), end->next()); + tok = tok->previous(); + eraseDeadCode(tok, end->next()); } } } diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 690e8aa04..5eb890fba 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -2375,16 +2375,6 @@ private: ASSERT_EQUALS("void foo ( ) { exit ( 0 ) ; }", 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() {