This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [LTO][PATCH] Fix ICE in output_tree.


2008/11/17 Doug Kwan (éæå) <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.


Diego.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]