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]

[LTO][PATCH] Fix ICE in output_tree.


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.

   Tested and bootstrapped on i686-unknown-linux-gnu.

-Doug

2008-11-17  Doug Kwan  <dougkwan@google.com>

        * lto.c (lto_fixup_const_decl, lto_fixup_field_decl,
        lto_fixup_function_decl, lto_fixup_var_decl, lto_fixup_parm_decl,
        lto_fixup_result_decl, lto_fixup_type_decl, lto_fixup_label_decl,
        lto_fixup_namespace_decl, lto_fixup_imported_decl,
        lto_fixup_translation_unit_decl, lto_fixup_binfo, lto_fixup_type):
        New functions.
        (lto_fixup_tree): Change function so that it is no longer a call-back
        of walk_tree.  Instead fixing-up is done by calling this function
        directly.  Adapt code from output_tree to perform tree traversal.
        (lto_fixup_state, lto_fixup_decls): Call lto_fixup_tree instead of
        walk_tree.

Attachment: patch.txt
Description: Text document


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