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

Richard Biener rguenther@suse.de
Tue Sep 15 16:52:00 GMT 2015


On September 15, 2015 4:25:37 PM GMT+02:00, Jason Merrill <jason@redhat.com> wrote:
>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.

That might work if we can get at all relevant decls that way.  If not we can populate a pointer-set from the function and walk that before writing the PCH. I can do that if you prefer, I just didn't know if we care about PCH performance enough to worry.

Thanks,
Richard.

>
>Jason




More information about the Gcc-patches mailing list