Skip to content

Commit 43de972

Browse files
committed
Fix
1 parent cc46f77 commit 43de972

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/check64bit.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ namespace {
4242

4343
static bool is32BitIntegerReturn(const Function* func, const Settings* settings)
4444
{
45+
if (settings->platform.sizeof_pointer != 8)
46+
return false;
4547
const ValueType* vt = func->arg->valueType();
46-
return vt && vt->isIntegral() && vt->typeSize(settings->platform) < settings->platform.sizeof_pointer;
48+
return vt && vt->isIntegral() && vt->typeSize(settings->platform) == 4;
4749
}
4850

4951
void Check64BitPortability::pointerassignment()

test/test64bit.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,11 @@ class Test64BitPortability : public TestFixture {
319319
"}\n");
320320
ASSERT_EQUALS("[test.cpp:2:5]: (portability) Returning an address value in a function with integer return type is not portable. [CastAddressToIntegerAtReturn]\n",
321321
errout_str());
322+
323+
check("bool f(const int* p) {\n"
324+
" return p;\n"
325+
"}\n");
326+
ASSERT_EQUALS("", errout_str());
322327
}
323328
};
324329

0 commit comments

Comments
 (0)