https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78600
Bug ID: 78600 Summary: gcc reads c++ object file during build for no apparent reason Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: bezemer at cs dot queensu.ca Target Milestone: --- I am a researcher in a team that is working on build systems and we are doing a case study on missing dependencies in the Qt 5.3.0 build system. I found something that we could not explain and I contacted the Qt mailing list... but I was forwarded to the gcc mailing list because it looks like we detected a bug in gcc. My question: The target for .obj/qgrayraster.o in the Makefile in qtbase/src/gui has a dependency on .pch/Qt5Gui.gch/c, but we noticed that during the build, the .pch/Qt5Gui.gch/c++ file is also read. Is there a reason why gcc would read the c++ file during the build? E.g. because c and c++ code is being mixed? We do not observe similar behaviour (i.e., the c file being read by g++) for targets that are compiled from .cpp files. Reply from one of the Qt maintainers: I can confirm it with strace. Seems like a bug because there is no C++ code mixed in for that particular compilation. You should check with GCC folks. The target in question: .obj/qgrayraster.o: painting/qgrayraster.c ../../include/QtGui/5.3.0/QtGui/private/qrasterdefs_p.h \ painting/qrasterdefs_p.h \ ../../include/QtGui/5.3.0/QtGui/private/qgrayraster_p.h \ painting/qgrayraster_p.h \ .pch/Qt5Gui.gch/c $(CC) -c -include .pch/Qt5Gui $(CFLAGS) $(INCPATH) -o .obj/qgrayraster.o painting/qgrayraster.c Sorry for not having a shorter working example.