summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/lto-streamer-in.c23
-rw-r--r--gcc/lto-streamer-out.c19
-rw-r--r--gcc/lto/ChangeLog6
-rw-r--r--gcc/lto/lto.c10
5 files changed, 30 insertions, 37 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 98f38c2fb95..99a153bda84 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2014-02-04 Richard Biener <rguenther@suse.de>
+
+ PR lto/59723
+ * lto-streamer-out.c (tree_is_indexable): Force NAMELIST_DECLs
+ in function context local.
+ (lto_output_tree_ref): Do not write trees from lto_output_tree_ref.
+ * lto-streamer-in.c (lto_input_tree_ref): Handle LTO_namelist_decl_ref
+ similar to LTO_imported_decl_ref.
+
2014-02-04 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/60002
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index df32a6b846a..68d3cdac41f 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -244,32 +244,11 @@ lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in,
case LTO_imported_decl_ref:
case LTO_label_decl_ref:
case LTO_translation_unit_decl_ref:
+ case LTO_namelist_decl_ref:
ix_u = streamer_read_uhwi (ib);
result = lto_file_decl_data_get_var_decl (data_in->file_data, ix_u);
break;
- case LTO_namelist_decl_ref:
- {
- tree tmp;
- vec<constructor_elt, va_gc> *nml_decls = NULL;
- unsigned i, n;
-
- result = make_node (NAMELIST_DECL);
- TREE_TYPE (result) = void_type_node;
- DECL_NAME (result) = stream_read_tree (ib, data_in);
- n = streamer_read_uhwi (ib);
- for (i = 0; i < n; i++)
- {
- ix_u = streamer_read_uhwi (ib);
- tmp = lto_file_decl_data_get_var_decl (data_in->file_data, ix_u);
- gcc_assert (tmp != NULL_TREE);
- CONSTRUCTOR_APPEND_ELT (nml_decls, NULL_TREE, tmp);
- }
- NAMELIST_DECL_ASSOCIATED_DECL (result) = build_constructor (NULL_TREE,
- nml_decls);
- break;
- }
-
default:
gcc_unreachable ();
}
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 5d6aed51845..94d2aa73ddd 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -139,7 +139,8 @@ tree_is_indexable (tree t)
return variably_modified_type_p (TREE_TYPE (DECL_CONTEXT (t)), NULL_TREE);
else if (((TREE_CODE (t) == VAR_DECL && !TREE_STATIC (t))
|| TREE_CODE (t) == TYPE_DECL
- || TREE_CODE (t) == CONST_DECL)
+ || TREE_CODE (t) == CONST_DECL
+ || TREE_CODE (t) == NAMELIST_DECL)
&& decl_function_context (t))
return false;
else if (TREE_CODE (t) == DEBUG_EXPR_DECL)
@@ -255,19 +256,9 @@ lto_output_tree_ref (struct output_block *ob, tree expr)
break;
case NAMELIST_DECL:
- {
- unsigned i;
- tree value, tmp;
-
- streamer_write_record_start (ob, LTO_namelist_decl_ref);
- stream_write_tree (ob, DECL_NAME (expr), true);
- tmp = NAMELIST_DECL_ASSOCIATED_DECL (expr);
- gcc_assert (tmp != NULL_TREE);
- streamer_write_uhwi (ob, CONSTRUCTOR_ELTS (tmp)->length());
- FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (tmp), i, value)
- lto_output_var_decl_index (ob->decl_state, ob->main_stream, value);
- break;
- }
+ streamer_write_record_start (ob, LTO_namelist_decl_ref);
+ lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr);
+ break;
case NAMESPACE_DECL:
streamer_write_record_start (ob, LTO_namespace_decl_ref);
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index a0c1be1a008..437e97e99f8 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-04 Richard Biener <rguenther@suse.de>
+
+ PR lto/59723
+ * lto.c (mentions_vars_p): Handle NAMELIST_DECL.
+ (lto_fixup_prevailing_decls): Handle fixing up CONSTRUCTOR values.
+
2014-02-04 Jan Hubicka <hubicka@ucw.cz>
Markus Trippelsdorf
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index c15f2128372..a769f25a214 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -926,6 +926,7 @@ mentions_vars_p (tree t)
case RESULT_DECL:
case IMPORTED_DECL:
case NAMESPACE_DECL:
+ case NAMELIST_DECL:
return mentions_vars_p_decl_common (t);
case VAR_DECL:
@@ -2597,7 +2598,7 @@ lto_fixup_prevailing_decls (tree t)
enum tree_code code = TREE_CODE (t);
bool fixed = false;
- gcc_checking_assert (code != CONSTRUCTOR && code != TREE_BINFO);
+ gcc_checking_assert (code != TREE_BINFO);
LTO_NO_PREVAIL (TREE_TYPE (t));
if (CODE_CONTAINS_STRUCT (code, TS_COMMON))
LTO_NO_PREVAIL (TREE_CHAIN (t));
@@ -2659,6 +2660,13 @@ lto_fixup_prevailing_decls (tree t)
for (i = TREE_OPERAND_LENGTH (t) - 1; i >= 0; --i)
LTO_SET_PREVAIL (TREE_OPERAND (t, i));
}
+ else if (TREE_CODE (t) == CONSTRUCTOR)
+ {
+ unsigned i;
+ tree val;
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (t), i, val)
+ LTO_SET_PREVAIL (val);
+ }
else
{
switch (code)