https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90326

            Bug ID: 90326
           Summary: Using any precompiled header breaks definition of
                    FLT_MAX
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: pch
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asmith at feralinteractive dot com
  Target Milestone: ---

With Fedora 30's GCC 9.0.1 (gcc (GCC) 9.0.1 20190312 (Red Hat 9.0.1-0.10)),
including any precompiled header will result in FLT_MAX being defined to 0,
rather than the correct value.

Reproduction test case:

10:40:54 ~ $ cat test.cpp
#include <float.h>
#include <stdio.h>
int main()
{
        float f = FLT_MAX;
        printf("%f\n", f);
        return 0;
}
10:40:56 ~ $ cat test.h
#define TEST 1
10:40:58 ~ $ g++ -o test test.cpp
10:41:08 ~ $ ./test
340282346638528859811704183484516925440.000000
10:41:10 ~ $ g++ -o test test.cpp -include test.h
10:41:16 ~ $ ./test
340282346638528859811704183484516925440.000000
10:41:17 ~ $ g++ -x c++-header -c test.h -o test.h.gch
10:41:28 ~ $ g++ -o test test.cpp -include test.h
10:41:32 ~ $ ./test
0.000000

I'm unsure if any other definitions are affected but FLT_MAX is the one that
was most obviously broken to me as the incorrect value causes us a ton of
issues.

GCC 8.3.0 on Arch Linux is not affected.

Reply via email to