https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91440
Bug ID: 91440 Summary: Precompiled headers regression in 9.2 Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rcopley at gmail dot com Target Milestone: --- In some circumstances, builds using precompiled headers which worked with GCC 9.1 no longer work with GCC 9.2. Complete test case (as a bash script): >precompiled.h echo "void f();" >main.c echo "void f() {}" mkdir some-subdir gcc -Winvalid-pch -pedantic -c -o some-subdir/precompiled.h.gch precompiled.h gcc -Winvalid-pch -pedantic -c -include some-subdir/precompiled.h -o main.o main.c # END OF SCRIPT Expected behaviour (as seen with GCC 9.1) is to succeed, with no output. Actual behaviour with GCC 9.2 is to fail, with output: cc1.exe: warning: ./.obj/precompiled.h.gch: had text segment at different address cc1.exe: error: one or more PCH files were found, but they were invalid cc1.exe: fatal error: .obj/precompiled.h: No such file or directory (The errors don't happen if you remove all occurrences of " -pedantic" and/or "some-subdir/" from the recipe.) Output of gcc -v (in 9.2): Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-9.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++ --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --enable-plugin --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld Thread model: posix gcc version 9.2.0 (Rev1, Built by MSYS2 project)