Hi,
Demo program:

/*********** DBL_MAX.c ***********/
#include <stdio.h>

#define MY_DBL_MAX 0x1.fffffffffffffp+1023

int main(void) {
  if(MY_DBL_MAX == 1.7976931348623157e+308) printf("OK1\n");
  else printf("%a\n%a\n", MY_DBL_MAX, 1.7976931348623157e+308);
  return 0;
}
/*********************************/

If I build the executable with:
gcc -o DBL_MAX.exe DBL_MAX.c
then the executable outputs "OK1" as expected.

But if I build with:
gcc -o DBL_MAX.exe DBL_MAX.c -std=c99
then the output changes to:
0x1.fffffffffffffp+1023
0x1.fffffffffffffp+1023

Why does this happen ?

It happens with:
gcc version 8.3.0 (i686-posix-dwarf, Built by strawberryperl.com project)
gcc version 10.3.0 (MinGW-W64 i686-posix-dwarf, built by Brecht Sanders)
gcc version 11.3.0 (MinGW-W64 i686-posix-dwarf, built by Brecht Sanders)
gcc version 12.2.0 (MinGW-W64 i686-msvcrt-posix-dwarf, built by Brecht
Sanders)
gcc version 13.1.0 (MinGW-W64 i686-msvcrt-mcf-dwarf, built by Brecht
Sanders)
gcc version 13.2.0 (MinGW-W64 i686-ucrt-mcf-dwarf, built by Brecht Sanders,
r3)

Those are the only 32-bit compilers I've tested.
64-bit compilers seem to be unaffected by this issue.

Although I often test 32-bit gcc on Windows, I don't actually rely on those
compilers - so I don't personally need a fix.
I just wanted to mention this issue in case it's in the "public interest".

Cheers,
Rob

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to