Hi! The following testcase failed with C++ but succeeded with C. The problem was that c-family/c-cppbuiltin.c was registered for GTY only for C, ObjC and ObjC++, but not for C++, so lazy_hex_fp_values[...].hex_str was garbage after reading the PCH file.
The first hunk fixes that, on the other side c-lex.c doesn't have any GTY markers and is not a gtfile for any other C family language. I've then compared the C, C++, ObjC and ObjC++ lists and found ObjC was missing c-format.c; the ObjC++ change is just to make sure c-cppbuiltin.c isn't mentioned twice after adding it to C++, because that is the only FE that generates gtfiles using scripting instead of full list. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk as obvious, will backport to 9.2 later. 2019-05-10 Jakub Jelinek <ja...@redhat.com> PR pch/90326 cp/ * config-lang.in (gtfiles): Remove c-family/c-lex.c, add c-family/c-cppbuiltin.c. objc/ * config-lang.in (gtfiles): Add c-family/c-format.c. objcp/ * config-lang.in (gtfiles): Don't add c-family/c-cppbuiltin.c. testsuite/ * g++.dg/pch/pr90326.C: New test. * g++.dg/pch/pr90326.Hs: New file. --- gcc/cp/config-lang.in.jj 2019-01-01 12:37:46.850487770 +0100 +++ gcc/cp/config-lang.in 2019-05-09 14:54:13.210293195 +0200 @@ -37,7 +37,7 @@ gtfiles="\ \$(srcdir)/c-family/c-pragma.h \$(srcdir)/cp/decl.h \ \$(srcdir)/cp/parser.h \ \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-format.c \ -\$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-pragma.c \ +\$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.c \ \$(srcdir)/cp/call.c \$(srcdir)/cp/class.c \$(srcdir)/cp/constexpr.c \ \$(srcdir)/cp/cp-gimplify.c \ \$(srcdir)/cp/cp-lang.c \$(srcdir)/cp/cp-objcp-common.c \ --- gcc/objc/config-lang.in.jj 2019-01-01 12:37:49.936437137 +0100 +++ gcc/objc/config-lang.in 2019-05-09 14:48:11.082368771 +0200 @@ -35,4 +35,4 @@ lang_requires="c" # Order is important. If you change this list, make sure you test # building without C++ as well; that is, remove the gcc/cp directory, # and build with --enable-languages=c,objc. -gtfiles="\$(srcdir)/objc/objc-map.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/c/c-parser.h \$(srcdir)/c/c-parser.c \$(srcdir)/c/c-tree.h \$(srcdir)/c/c-decl.c \$(srcdir)/c/c-lang.h \$(srcdir)/c/c-objc-common.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c" +gtfiles="\$(srcdir)/objc/objc-map.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/objc/objc-act.h \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-runtime-shared-support.c \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-01.c \$(srcdir)/objc/objc-next-runtime-abi-02.c \$(srcdir)/c/c-parser.h \$(srcdir)/c/c-parser.c \$(srcdir)/c/c-tree.h \$(srcdir)/c/c-decl.c \$(srcdir)/c/c-lang.h \$(srcdir)/c/c-objc-common.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/c-family/c-format.c" --- gcc/objcp/config-lang.in.jj 2019-01-01 12:37:51.388413314 +0100 +++ gcc/objcp/config-lang.in 2019-05-09 14:49:18.714235493 +0200 @@ -52,7 +52,6 @@ gtfiles="$(. $srcdir/cp/config-lang.in ; gtfiles="$gtfiles \ \$(srcdir)/objc/objc-act.h \ \$(srcdir)/objc/objc-map.h \ -\$(srcdir)/c-family/c-cppbuiltin.c \ \$(srcdir)/objc/objc-act.c \ \$(srcdir)/objc/objc-gnu-runtime-abi-01.c \ \$(srcdir)/objc/objc-next-runtime-abi-01.c \ --- gcc/testsuite/g++.dg/pch/pr90326.C.jj 2019-05-09 15:04:44.475697021 +0200 +++ gcc/testsuite/g++.dg/pch/pr90326.C 2019-05-09 15:07:15.145167975 +0200 @@ -0,0 +1,9 @@ +#include "pr90326.H" + +int main() +{ + float f = __FLT_MAX__; + if (f == 0.0) + __builtin_abort (); + return 0; +} --- gcc/testsuite/g++.dg/pch/pr90326.Hs.jj 2019-05-09 15:04:47.853640320 +0200 +++ gcc/testsuite/g++.dg/pch/pr90326.Hs 2019-05-09 15:07:22.296048802 +0200 @@ -0,0 +1,1 @@ +// empty Jakub