Fixed #5244 (FP: (error) Uninitialized variable: ptr - initialization within if-clause)
This commit is contained in:
parent
a3bc80bd7d
commit
177bf6fcb3
|
@ -4790,6 +4790,7 @@ void Tokenizer::simplifyCasts()
|
|||
}
|
||||
|
||||
while ((Token::Match(tok->next(), "( %type% *| *| *| ) *|&| %var%") && (tok->str() != ")" || tok->tokAt(2)->isStandardType())) ||
|
||||
Token::Match(tok->next(), "( const| %type% * *| *| ) *|&| %var%") ||
|
||||
Token::Match(tok->next(), "( const| %type% %type% *| *| *| ) *|&| %var%") ||
|
||||
(!tok->isName() && (Token::Match(tok->next(), "( %type% * *| *| ) (") ||
|
||||
Token::Match(tok->next(), "( const| %type% %type% * *| *| ) (")))) {
|
||||
|
|
|
@ -1185,6 +1185,8 @@ private:
|
|||
void removeCast14() { // const
|
||||
// #5081
|
||||
ASSERT_EQUALS("( ! ( & s ) . a )", tokenizeAndStringify("(! ( (struct S const *) &s)->a)", true));
|
||||
// #5244
|
||||
ASSERT_EQUALS("bar ( & ptr ) ;", tokenizeAndStringify("bar((const X**)&ptr);",true));
|
||||
}
|
||||
|
||||
void simplifyFloatCasts() { // float casting integers
|
||||
|
|
Loading…
Reference in New Issue