I get an ICE when trying to generate a precompiled header, when the command-line has a "-include" of that same precompiled header, but only when the header already exists in precompiled form.
It may sound like a strange usage to -include the same file on the command-line as is being generated, but the actual usage scenario involves a makefile where the CPPFLAGS variable has "-include project.h", and then the build rule to generate project.h.gch from project.h uses $(CPPFLAGS) in the compiler command. That case has a trivial workaround, of course, just by having the makefile rule do a "rm -f project.h.gch" before trying to rebuild it. I noticed bug 13675, which sounds related, but I thought this situation might be different since it triggers an ICE where bug 13675 actually gives a "bad file descriptor" error message. Like bug 13675, this ICE occurs only when using "g++", and not with "gcc". Here is the test case: $ ls inc.h # Note that inc.h.gch does not exist yet $ cat inc.h #ifndef INC_INCLUDED_H #define INC_INCLUDED_H #include <stdio.h> #endif $ ~/local/gcc-4.2-20060401/bin/g++ -include inc.h -x c++ -c inc.h -o inc.h.gch $ ls inc.h inc.h.gch # Now we've successfully built inc.h.gch $ ~/local/gcc-4.2-20060401/bin/g++ -include inc.h -x c++ -c inc.h -o inc.h.gch inc.h:1: internal compiler error: Bus error Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. $ ls inc.h # Now after the ICE, inc.h.gch has gone away again I get the same behavior with each of 3.4.4, 4.1.0, and 4.2.0 (as of 20060401): gcc version 3.4.4 20050721 (Red Hat 3.4.4-2) gcc version 4.1.0 20060304 (Red Hat 4.1.0-3) gcc version 4.2.0 20060401 (experimental) Thanks, Rob -- Summary: ICE when generate a precompiled header, and the same header is given to -include on the command-line Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rjpeters at klab dot caltech dot edu GCC build triplet: i386-redhat-linux GCC host triplet: i386-redhat-linux GCC target triplet: i386-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27475