This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug pch/57242] gcc ignores precompiled headers unless the .gch and TU's are compiled with certain combinations of -g flag
- From: "scottbaldwin at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 10 May 2013 17:15:44 +0000
- Subject: [Bug pch/57242] gcc ignores precompiled headers unless the .gch and TU's are compiled with certain combinations of -g flag
- Auto-submitted: auto-generated
- References: <bug-57242-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57242
--- Comment #3 from etherice <scottbaldwin at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> This is by design as -g changes the information produced by the front-end
> and maybe even predefines too.
I think you may have read the report too quickly :)
When building the .gch file, and then subsequently building the translation
unit that uses the .gch ... even if you do not specify a -gN at all, or specify
the SAME -gN (unless both are -g3), the .gch will be ignored when compiling the
TU. For example, using -g2 for both (.gch and TU) will cause pch to be ignored.
Or using no -g flag at all for both (.gch and TU) will cause pch to be ignored.
You MUST specify a -g flag (either -g -g2 or -g3) when building the .gch, and
you must specify EXACTLY -g3 when building the TU. I hope that clarifies it.