This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: compiler rebuild invalidates precompiled header
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: "Jan Beulich" <JBeulich at novell dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: 14 May 2004 12:17:13 -0400
- Subject: Re: compiler rebuild invalidates precompiled header
- References: <s0a4fbcc.034@emea1-mh.id2.novell.com>
"Jan Beulich" <JBeulich@novell.com> writes:
> Trying to run the libstdc++ testsuite after a couple of rebuilds to the
> compiler all I got was internal compiler errors for each and every
> compiled file. Investigating this, I had to learn that the precompiled
> header stores not just configuration values, but also pointers created
> during the previous build (e.g. into the compiler image itself). This
> would be fine, if the precompiled header would be considered invalid by
> a compiler build different from the one that created it. That, however,
> is not done, and what I'm trying to find out is whether this is
> intentional (in which case I'd consider precompiled headers useless for
> anyone trying to work on the compiler itself), and if so if there is any
> suggested workaround for this (other than manually deleting the
> precompiled headers each time the compiler gets rebuilt).
> Obviously, I'd consider this a bug with the suggested solution of
> adding a timestamp (or even better a random value of good quality) to
> the compiler that it then stores into the precompiled header and
> verifies when it loads it).
The PCH code is intended to check whether a PCH is being loaded by a
different instance of the compiler. See c_common_valid_pch().
However, the current test is fairly simple--it just checks whether the
address of the function pch_init() is the same. That is probably a
safe enough check for released versions of gcc, but it is not very
safe for developers rebuilding the compiler after minor patches.
Ian