This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [LTO][PATCH] Fix ICE in output_tree.
- From: Diego Novillo <dnovillo at google dot com>
- To: Doug Kwan (éæå) <dougkwan at google dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 17 Nov 2008 16:54:30 -0500
- Subject: Re: [LTO][PATCH] Fix ICE in output_tree.
- References: <498552560811170101o17770ee5k73bd6ed68b6db4ef@mail.gmail.com>
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.