[LTO][PATCH] Fix ICE in output_tree.

Richard Guenther richard.guenther@gmail.com
Mon Nov 17 22:10:00 GMT 2008


On Mon, Nov 17, 2008 at 3:54 PM, Diego Novillo <dnovillo@google.com> wrote:
> 2008/11/17 Doug Kwan ($Bop?6y~(B) <dougkwan@google.com>:
>> Hi Diego,
>>
>>   This patch fixes a problem where we see dangling pointer caused by
>> premature freeing of DECLs.  The code in lto_fixup_logic tries to
>> replace DECLs and trees and then free those DECLs that are not longer
>> used.  In the past we use walk_tree and a call-back to do the tree
>> traversal.  This had missed the case of BINFOs and I added code into
>> call-back to fix it in the past.  We now hit this problem again
>> because FIELD_DECLs are not proper traversed by walk_tree.  In stead
>> of lumping more code in the call-back to catch the fall-out from
>> walk_tree, I am now changing the code in lto_fixup_tree to do
>> traversal without walk_tree.  I adapted code from the lto-streamer in
>> lto-function-out.c.
>
> The problem I see with this approach is that it adds a lot of bulk
> just to catch other sub-fields.  What is walk_tree missing?  We
> generally just handled things that walk_tree doesn't look at.  Is it
> really more code adding the missing cases to walk_tree?
>
> How about this alternative.  During streaming, we push into a vector
> the addresses of all the DECLs that will need fixup afterwards.  Then
> in lto_fixup_decls we just have to traverse this array and be done
> with it.

We shouldn't need BINFOs at LTO time, no?

Richard.



More information about the Gcc-patches mailing list