Skip to content

Commit 4f88fdc

Browse files
committed
Check64Bit: Fixed false positive about returning integer for 'p+(n*80)'
1 parent 1959377 commit 4f88fdc

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

lib/check64bit.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ void Check64BitPortability::pointerassignment()
7474
type = INT;
7575
else if (type == PTR && Token::Match(tok2, "- %var%") && isaddr(tok2->next()->variable()))
7676
type = PTRDIFF;
77-
else if (Token::Match(tok2, "%type% (")) {
77+
else if (Token::Match(tok2, "(")) {
78+
type = NO;
79+
break;
80+
} else if (tok2->str() == "(") {
81+
// TODO: handle parentheses
7882
type = NO;
7983
break;
8084
} else if (type == PTR && Token::simpleMatch(tok2, "."))

test/test64bit.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ class Test64BitPortability : public TestFixture {
193193
" return 1 + p->i;\n"
194194
"}");
195195
ASSERT_EQUALS("", errout.str());
196+
197+
check("static void __iomem *f(unsigned int port_no) {\n"
198+
" void __iomem *mmio = hpriv->mmio;\n"
199+
" return mmio + (port_no * 0x80);\n"
200+
"}");
201+
ASSERT_EQUALS("", errout.str());
196202
}
197203
};
198204

0 commit comments

Comments
 (0)