Skip to content

Commit

Permalink
Fix gcc armel/arm64 build (#53220)
Browse files Browse the repository at this point in the history
* Fix gcc armel build

Mostly signed/unsigned comparisons, etc.

* Fix gcc arm64 build
  • Loading branch information
gbalykov committed Jun 9, 2021
1 parent 626ceb7 commit f6c52b9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/coreclr/ToolBox/superpmi/superpmi-shared/lightweightmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class LightWeightMap : public LightWeightMapBuffer

// If we have RTTI, we can make this assert report the correct type. No RTTI, though, when
// built with .NET Core, especially when built against the PAL.
AssertCodeMsg((ptr - bytes) == size, EXCEPTIONCODE_LWM, "%s - Ended with unexpected sizes %p != %x",
AssertCodeMsg(ptr == (bytes + size), EXCEPTIONCODE_LWM, "%s - Ended with unexpected sizes %p != %x",
"Unknown type" /*typeid(_Item).name()*/, (void*)(ptr - bytes), size);
return size;
}
Expand Down Expand Up @@ -656,7 +656,7 @@ class DenseLightWeightMap : public LightWeightMapBuffer
ptr += bufferLength * sizeof(unsigned char);
}

AssertCodeMsg((ptr - bytes) == size, EXCEPTIONCODE_LWM, "Ended with unexpected sizes %Ix != %x", ptr - bytes,
AssertCodeMsg(ptr == (bytes + size), EXCEPTIONCODE_LWM, "Ended with unexpected sizes %Ix != %x", ptr - bytes,
size);
return size;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ void CodeGen::genLclHeap(GenTree* tree)
}

// regCnt will be the total number of bytes to locAlloc
genSetRegToIcon(regCnt, amount, ((int)amount == amount) ? TYP_INT : TYP_LONG);
genSetRegToIcon(regCnt, amount, TYP_INT);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7137,8 +7137,8 @@ bool GenTreeOp::UsesDivideByConstOptimized(Compiler* comp)
else
{
// If the divisor is greater or equal than 2^(N - 1) then the result is either 0 or 1
if (((divType == TYP_INT) && (divisorValue > (UINT32_MAX / 2))) ||
((divType == TYP_LONG) && (divisorValue > (UINT64_MAX / 2))))
if (((divType == TYP_INT) && ((UINT32)divisorValue > (UINT32_MAX / 2))) ||
((divType == TYP_LONG) && ((UINT64)divisorValue > (UINT64_MAX / 2))))
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/pal/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ if(CLR_CMAKE_HOST_ARCH_ARM)
endif()
endif(CLR_CMAKE_HOST_ARCH_ARM)

if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND (CLR_CMAKE_HOST_ARCH_AMD64 OR CLR_CMAKE_HOST_ARCH_I386))
add_compile_options(-Wa,--divide)
endif()

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/pal/src/misc/jitsupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static const CpuCapability CpuCapabilities[] = {
// If the capability name is not recognized or unused at present, zero is returned.
static unsigned long LookupCpuCapabilityFlag(const char* start, size_t length)
{
for (int i = 0; i < _countof(CpuCapabilities); i++)
for (size_t i = 0; i < _countof(CpuCapabilities); i++)
{
const char* capabilityName = CpuCapabilities[i].name;
if ((length == strlen(capabilityName)) && (memcmp(start, capabilityName, length) == 0))
Expand Down

0 comments on commit f6c52b9

Please sign in to comment.