This is the mail archive of the
mailing list for the GCC project.
Fix Firefox LTO ICE
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org, rguenther at suse dot de
- Date: Mon, 14 Jul 2014 00:16:15 +0200
- Subject: Fix Firefox LTO ICE
- Authentication-results: sourceware.org; auth=none
I updated my firefox tree and now I get ICE at:
/aux/hubicka/firefox2/firefox/intl/icu/source/i18n/ucol_bld.cpp:1274:51: note: in statement
el.prefix = el.prefixChars;
# .MEM_339 = VDEF <.MEM_338>
el.prefix = &el.prefixChars;
lto1: error: address taken, but ADDRESSABLE bit not set
The variable have correctly set TREE_ADDRESSABLE bit in the LTO stream, but the bit is cleared
when doing TODO after inlining into completely different function. This is becuase the
variable appears incorreclty in local_decls in that function. It is added there by inliner
remap_decls (tree decls, vec<tree, va_gc> **nonlocalized_list,
tree new_decls = NULL_TREE;
/* Remap its variables. */
for (old_var = decls; old_var; old_var = DECL_CHAIN (old_var))
if (can_be_nonlocal (old_var, id))
/* We need to add this variable to the local decls as otherwise
nothing else will do so. */
if (TREE_CODE (old_var) == VAR_DECL
&& ! DECL_EXTERNAL (old_var))
add_local_decl (cfun, old_var);
(while remapping BLOCK of the function being inlined that is yet another function).
This reason is that old_var appears incorrectly in the BLOCK_VARS list because that
list starts by IMPORT_DECL that is streamed into global stream and then inserted
into multiple lists resulting in a bad soup.
The following patch seems to fix it. I think we can safely duplicate this beast into
each function that use it.
Bootstrap/regtested in progress, tested with firefox.
* lto-streamer-out.c (tree_is_indexable): Imported_decl is not indexable.
--- lto-streamer-out.c (revision 212479)
+++ lto-streamer-out.c (working copy)
@@ -139,6 +139,9 @@ tree_is_indexable (tree t)
if (TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL)
return variably_modified_type_p (TREE_TYPE (DECL_CONTEXT (t)), NULL_TREE);
+ /* IMPORTED_DECL is put into BLOCK and thus it never can be shared. */
+ else if (TREE_CODE (t) == IMPORTED_DECL)
+ return false;
else if (((TREE_CODE (t) == VAR_DECL && !TREE_STATIC (t))
|| TREE_CODE (t) == TYPE_DECL
|| TREE_CODE (t) == CONST_DECL