[PATCH][C++] Avoid PCH dependent mangling

Jason Merrill jason@redhat.com
Tue Sep 15 14:27:00 GMT 2015


On 08/27/2015 09:36 AM, Richard Biener wrote:
>
> With the passes.c hunk in the patch below we FAIL assembly comparison
> of g++.dg/pch/system-[12].C because with PCH we have computed
> DECL_ASSEMBLER_NAME and thus appended DW_AT_linkage_name early during
> PCH generation while without PCH we compute it lazily and end up
> appending DW_AT_specification earlier.  Thus we have swapped dwarf
> attribute order and assembly comparison fails.
>
> Clearly this kind of "IL" changes dependent on whether we are writing
> a PCH file is going to cause differences down the food chain.
> (there is another case in instantiate_decl calling add_pending_template
> dependent on pch_file)
>
> Now a simple solution is to simply not do that (mangle decls).  Another
> would be to always mangle decls where we now do so conditional on PCH.
> Another soulution is to declare we don't care about assembly differences
> with/without using PCH and remove assembly comparison from the
> testsuite harness.

Hmm, what if we walk through the symtab and mangle everything later, 
when we're about to write the PCH?  That should still get the benefit of 
doing the mangling work only once, without changing the order of the 
attributes.

Jason



More information about the Gcc-patches mailing list