Skip to content

wasm::is{U,S}Integer64() doesn't work well around INT64_MAX #2291

Open
@tzik

Description

@tzik

The latest clang points a minor bug for -Wimplicit-int-float-conversion.

On the implementation of wasm::wasm::isUInteger64, std::numeric_limits<uint64_t>::max() is implicitly converted to double.
As double has only 53 bit for digits on typical systems, and the conversion rounds the value to 0x1p64 rather than 0x1p64 - 1, that implies isUInteger64(0x1p64) returns true, which is wrong.

We should probably use fixed double literals like 0x1p64, -0x1p63, and 0x1p63 for the boundary check here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions