This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/42401] wrong-code with -flto
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Dec 2009 00:41:08 -0000
- Subject: [Bug lto/42401] wrong-code with -flto
- References: <bug-42401-8535@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from rguenth at gcc dot gnu dot org 2009-12-19 00:41 -------
The following seems to fix it for some reason.
Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c (revision 155347)
+++ lto-streamer-out.c (working copy)
@@ -638,7 +638,8 @@ tree_is_indexable (tree t)
{
if (TREE_CODE (t) == PARM_DECL)
return false;
- else if (TREE_CODE (t) == VAR_DECL && decl_function_context (t))
+ else if (TREE_CODE (t) == VAR_DECL && decl_function_context (t)
+ && !TREE_STATIC (t))
return false;
else
return (TYPE_P (t) || DECL_P (t) || TREE_CODE (t) == SSA_NAME);
@@ -694,7 +695,8 @@ lto_output_tree_ref (struct output_block
case VAR_DECL:
case DEBUG_EXPR_DECL:
- gcc_assert (decl_function_context (expr) == NULL);
+ gcc_assert (decl_function_context (expr) == NULL
+ || TREE_STATIC (expr));
output_record_start (ob, LTO_global_decl_ref);
lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr);
break;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42401