https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80238
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |doko at gcc dot gnu.org --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- So if comment #5 is correct then it seems we are building stage1 genmatch against the (not yet built) libstdc++ headers but linking (-static-libstdc++) against the host compilers library. Unfortunately the provided log doesn't tell how build/genmatch.o was built. Trying myself we do (correctly): g++ -std=gnu++98 -c -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -DGENERATOR_FILE -fno-PIE -I. -Ibuild -I/space/rguenther/src/svn/gcc-6-branch/gcc -I/space/rguenther/src/svn/gcc-6-branch/gcc/build -I/space/rguenther/src/svn/gcc-6-branch/gcc/../include -I/space/rguenther/src/svn/gcc-6-branch/gcc/../libcpp/include \ -o build/genmatch.o /space/rguenther/src/svn/gcc-6-branch/gcc/genmatch.c and in my experiments I can compile GCC 6.3 with 4.9.2 just fine so maybe Debian backported some changes in a wrong way. I suggest to report this bug to Debian instead (CCing packager). Note that you seem to do a build in-tree which isn't recommended. Can you try to build in a separate object directory instead?