Fixed #6044 (hang: darkplaces / cl_particles.c)

This commit is contained in:
Daniel Marjamäki 2014-08-14 06:13:42 +02:00
parent f0cb6ef33d
commit e83f08a825
2 changed files with 10 additions and 1 deletions

View File

@ -827,8 +827,11 @@ static bool valueFlowForward(Token * const startToken,
"no simplification of " + tok2->str() + " within " + (Token::Match(parent,"[?:]") ? "?:" : parent->str()) + " expression");
while (parent && parent->str() != "(")
parent = parent->astParent();
if (parent)
if (parent) {
tok2 = const_cast<Token*>(parent->link());
if (Token::simpleMatch(tok2, ") ("))
tok2 = tok2->linkAt(1);
}
continue;
}

View File

@ -957,6 +957,12 @@ private:
TODO_ASSERT_EQUALS(true, false, testValueOfX(code, 3U, 0));
ASSERT_EQUALS(false, testValueOfX(code, 4U, 0));
code = "void f() {\n" // #6044 - hang
" decal_t *decal = &decals[i++];\n"
" x = (int)((decal) && (decal->color));\n"
"}";
testValueOfX(code, 0U, 0);
// TODO: float
code = "void f(float x) {\n"
" if (x == 0.5) {}\n"