Menu

#725 strtold() does not parse hexadecimal strings

v1.0 (example)
open
nobody
None
3
2018-07-01
2018-04-23
Sisyphus
No

Hi,
Both strtoflt128() and strtod() correctly parse hex input strings (eq "0xdead") and assign values correctly.
However, strtold() just assigns them as zero, and dumps everything after the leading "0" into the string specified by strtold's second argument.
I'm using gcc version 7.2.0 (i686-posix-dwarf-rev1, Built by MinGW-W64 project) and gcc version 7.2.0 (x86_64-posix-seh-rev1, Built by MinGW-W64 project) - both of which, I believe, use the latest mingw runtime.

Attached is the demo (and it's output on Windows), which I built with "gcc -o try.exe try.c -lquadmath".
On Ubuntu, strtold() parses the hex string as expected, and assigns the correct value.

Cheers,
Rob

1 Attachments

Discussion

  • Zufu Liu

    Zufu Liu - 2018-04-23

    Same result with gcc version 7.3.0 x86_64-posix-seh-rev0.

     
  • Sisyphus

    Sisyphus - 2018-07-01

    It's also the same result with 8.1.0.
    However, as a workaround, calling __mingw_strtold() instead of strtold() works fine on 8.1.0.
    I haven't checked whether the same workaround is successful with earlier versions of gcc, but I'm hopeful that it does.

    Cheers,
    Rob

     

Log in to post a comment.

MongoDB Logo MongoDB