Steps to reproduce:
- Write small test program in the C programming language.
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
double dbl;
dbl = atof("nan");
if(dbl != dbl)
{
puts("gud");
}
else
{
puts("bad");
}
}
- Compile the program using latest x64 version of w64devkit.
gcc atof.c
- Run the program.
./a.exe
Expected result:
Actual result:
Repeat this experiment with the MSVC and cl.exe C compiler and the result is as expected.
The reason for this bad behavior is that the w64devkit is using the msvcrt.dll C run-time library as its libc. I believe that this library is quite old, unmaintained and buggy. Only god knows how many other issues is waiting for us inside this library. Especially related to new functionality added in later C standards. It is sad, that the gcc is able to compile newer C but is held back by old libc.
Thus, in this issue, I'm suggesting to replace dependency on msvcrt.dll by dependency on ucrtbase.dll.
This library is considered as part of Windows since Windows 10 and can be installed by Windows Update on Windows XP and later. So there should be no downsides by changing this dependency.
Steps to reproduce:
gcc atof.c./a.exeExpected result:
gudActual result:
badRepeat this experiment with the MSVC and
cl.exeC compiler and the result is as expected.The reason for this bad behavior is that the w64devkit is using the
msvcrt.dllC run-time library as its libc. I believe that this library is quite old, unmaintained and buggy. Only god knows how many other issues is waiting for us inside this library. Especially related to new functionality added in later C standards. It is sad, that thegccis able to compile newer C but is held back by old libc.Thus, in this issue, I'm suggesting to replace dependency on
msvcrt.dllby dependency onucrtbase.dll.This library is considered as part of Windows since Windows 10 and can be installed by Windows Update on Windows XP and later. So there should be no downsides by changing this dependency.