parent
639a4131c4
commit
aa281501c9
|
@ -498,7 +498,7 @@ bool FwdAnalysis::unusedValue(const Token *expr, const Token *startToken, const
|
|||
|
||||
bool FwdAnalysis::possiblyAliased(const Token *expr, const Token *startToken) const
|
||||
{
|
||||
if (expr->isUnaryOp("*"))
|
||||
if (expr->isUnaryOp("*") && !expr->astOperand1()->isUnaryOp("&"))
|
||||
return true;
|
||||
|
||||
const bool macro = false;
|
||||
|
@ -540,7 +540,7 @@ bool FwdAnalysis::possiblyAliased(const Token *expr, const Token *startToken) co
|
|||
continue;
|
||||
|
||||
for (const Token *subexpr = expr; subexpr; subexpr = subexpr->astOperand1()) {
|
||||
if (isSameExpression(mCpp, macro, subexpr, addrOf, mLibrary, pure, followVar))
|
||||
if (subexpr != addrOf && isSameExpression(mCpp, macro, subexpr, addrOf, mLibrary, pure, followVar))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2641,11 +2641,11 @@ private:
|
|||
"}");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Variable '*(b+i)' is assigned a value that is never used.\n", "", errout.str());
|
||||
|
||||
functionVariableUsage("void f() {\n" // #11832
|
||||
functionVariableUsage("void f() {\n" // #11832, #11923
|
||||
" int b;\n"
|
||||
" *(&b) = 0;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (style) Variable '*(&b)' is assigned a value that is never used.\n", errout.str());
|
||||
}
|
||||
|
||||
void localvar8() {
|
||||
|
|
Loading…
Reference in New Issue