This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ICE with precompiled headers (GCC 8.1)


On April 30, 2019 7:43:47 AM MDT, Paul Smith <paul@mad-scientist.net> wrote:
>I have GCC 8.1.0 / binutils 2.30 on GNU/Linux 64bit (built locally). 
>My codebase is almost all C++.
>
>I'm implementing precompiled headers and it was going well.  However,
>sometimes a PCH file is generated that causes the compiler to ICE when
>trying to use it during a source file compilation:
>
>  <command-line>: internal compiler error: Segmentation fault
>  Please submit a full bug report,
>  with preprocessed source if appropriate.
>  See <https://gcc.gnu.org/bugs/> for instructions.
>
>If I rename the .gch file and compile the source it works; if I put
>back the .gch file and compile the source it will ICE again.  So
>clearly there's something corrupt about the PCH file itself.
>
>Also this does not happen every time, even using the identical code. 
>Sometimes the PCH file is fine and the compile is fine.  It has never
>happened on my local system but it happens quite often on some of our
>build servers (typically these are a bit older/slower with slower
>disks).  And, it doesn't happen to all PCH files in the same build (I
>create different PCH files for different libraries), even ones that
>include the same files!
>
>Since it's not reproducible and the code is proprietary I haven't tried
>to produce a publishable case so far.
>
>Here's the thing: I added the "-MD -MF foo.d" options to the PCH file
>compile (I wanted to get a manifest of which files were included in the
>PCH file).  Without those options I cannot reproduce this at all (in a
>number of tries).  With those options it happens most of the time on
>some systems (but again, never on my local system).
>
>Unfortunately my GCC is heavily optimized and stripped so backtraces
>are useless.  I will generate a debuggable GCC and see if I can get
>more info on the ICE.
>
>In the meantime, does this remind anyone of an existing bug, hopefully
>one that was fixed in 8.2 or 8.3?

It does remind me of a race condition bug with a Makefile I wrote years ago.

One or two build tasks did not properly depend on the precompiled headers but used them anyway, and sometimes during make -j8 would get unlucky and use a partial header file.
-- 
                Knowledge is Power -- Power Corrupts
                        Study Hard -- Be Evil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]