#6744 segmentation fault (invalid code) in Tokenizer::simplifyPointerToStandardType. #6745 segmentation fault (invalid code) in Tokenizer::simplifyTypedef
This commit is contained in:
parent
454d4573b4
commit
6e1b5a0a53
|
@ -1194,7 +1194,7 @@ void Tokenizer::simplifyTypedef()
|
||||||
if (simplifyType) {
|
if (simplifyType) {
|
||||||
// can't simplify 'operator functionPtr ()' and 'functionPtr operator ... ()'
|
// can't simplify 'operator functionPtr ()' and 'functionPtr operator ... ()'
|
||||||
if (functionPtr && (tok2->previous()->str() == "operator" ||
|
if (functionPtr && (tok2->previous()->str() == "operator" ||
|
||||||
tok2->next()->str() == "operator")) {
|
(tok2->next() && tok2->next()->str() == "operator"))) {
|
||||||
simplifyType = false;
|
simplifyType = false;
|
||||||
tok2 = tok2->next();
|
tok2 = tok2->next();
|
||||||
continue;
|
continue;
|
||||||
|
@ -5213,6 +5213,8 @@ void Tokenizer::simplifyPointerToStandardType()
|
||||||
tok->next()->eraseTokens(tok->next(), tok->tokAt(5));
|
tok->next()->eraseTokens(tok->next(), tok->tokAt(5));
|
||||||
// Remove '&' prefix
|
// Remove '&' prefix
|
||||||
tok = tok->previous();
|
tok = tok->previous();
|
||||||
|
if (!tok)
|
||||||
|
break;
|
||||||
tok->deleteNext();
|
tok->deleteNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,8 @@ private:
|
||||||
TEST_CASE(garbageCode64);
|
TEST_CASE(garbageCode64);
|
||||||
TEST_CASE(garbageCode65);
|
TEST_CASE(garbageCode65);
|
||||||
TEST_CASE(garbageCode66);
|
TEST_CASE(garbageCode66);
|
||||||
|
TEST_CASE(garbageCode67);
|
||||||
|
TEST_CASE(garbageCode68);
|
||||||
|
|
||||||
TEST_CASE(garbageValueFlow);
|
TEST_CASE(garbageValueFlow);
|
||||||
TEST_CASE(garbageSymbolDatabase);
|
TEST_CASE(garbageSymbolDatabase);
|
||||||
|
@ -590,6 +592,14 @@ private:
|
||||||
ASSERT_THROW(checkCode("{ { } }; { { } }; { }; class bar : public virtual"), InternalError);
|
ASSERT_THROW(checkCode("{ { } }; { { } }; { }; class bar : public virtual"), InternalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void garbageCode67() { // #6744
|
||||||
|
checkCode("&g[0]; { (g[0] 0) } =", "test.c");
|
||||||
|
}
|
||||||
|
|
||||||
|
void garbageCode68() { // #6745
|
||||||
|
checkCode("(int a[3]); typedef void (*fp) (void); fp");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void garbageValueFlow() {
|
void garbageValueFlow() {
|
||||||
// #6089
|
// #6089
|
||||||
|
|
Loading…
Reference in New Issue