Skip to content

[wasm2c] Strange issue with double parsing in msvc #2422

@sbc100

Description

@sbc100

For some reason INT_MIN is not parsing correctly under MSVC..

#include <stdio.h>

int main() {
  double x = -2147483648;
  double y = -2147483648L;
  double z = -2147483648.0;
  printf("%f\n", x);
  printf("%f\n", y);
  printf("%f\n", z);
}

Under MSVC this produces:

2147483648.000000
2147483648.000000
-2147483648.000000

i.e. only adding .0 at the end causes the sign bit to be preserved.

Gcc and clang both (correctly I believe) produce:

-2147483648.000000
-2147483648.000000
-2147483648.000000

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