Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

build failed on clang5.0 #7619

@cshung

Description

@cshung

On 32 bit architectures, size_t is an unsigned 32 bit integer, and therefore the condition can never be true. On clang5.0, this becomes a warning and blocks the build.

/corert/src/Native/gc/unix/cgroup.cpp:440:31: error: comparison of constant 9223372032559808512 with expression of type 'size_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
    if (physical_memory_limit > 0x7FFFFFFF00000000)
        ~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
1 error generated.

Here is the associated code:

    // If there's no memory limit specified on the container this 
    // actually returns 0x7FFFFFFFFFFFF000 (2^63-1 rounded down to 
    // 4k which is a common page size). So we know we are not
    // running in a memory restricted environment.
    if (physical_memory_limit > 0x7FFFFFFF00000000)
    {
        return 0;
    }

All we have to do is to figure out what would be returned on an unrestricted 32-bit execution environment. I have tried it on a physical arm32 device, without being inside a Docker container, it returned 0 because FindHierarchyMount finds nothing.

According to this thread, it appears to me that for 32-bits architectures, we should probably check against a different constant, I haven't figured that out yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions