We were not pushing the initialization protector of a file-scope static
into its own scope. My cleanup of name-lookup will barf on that
mismatch, so fix it now.
When we push an error_mark_node local var, we can just call pushdecl,
and that'll allow me to get rid of push_local_binding.
nathan
--
Nathan Sidwell
2017-05-05 Nathan Sidwell <nat...@acm.org>
* call.c (make_temporary_var_for_ref_to_temp): Push decl into
current scope.
* lex.c (unqualified_name_lookup_error): Likewise.
Index: call.c
===================================================================
--- call.c (revision 247636)
+++ call.c (working copy)
@@ -10234,10 +10234,7 @@ perform_direct_initialization_if_possibl
tree
make_temporary_var_for_ref_to_temp (tree decl, tree type)
{
- tree var;
-
- /* Create the variable. */
- var = create_temporary_var (type);
+ tree var = create_temporary_var (type);
/* Register the variable. */
if (VAR_P (decl)
@@ -10245,15 +10242,16 @@ make_temporary_var_for_ref_to_temp (tree
{
/* Namespace-scope or local static; give it a mangled name. */
/* FIXME share comdat with decl? */
- tree name;
TREE_STATIC (var) = TREE_STATIC (decl);
CP_DECL_THREAD_LOCAL_P (var) = CP_DECL_THREAD_LOCAL_P (decl);
set_decl_tls_model (var, DECL_TLS_MODEL (decl));
- name = mangle_ref_init_variable (decl);
+
+ tree name = mangle_ref_init_variable (decl);
DECL_NAME (var) = name;
SET_DECL_ASSEMBLER_NAME (var, name);
- var = pushdecl_top_level (var);
+
+ var = pushdecl (var);
}
else
/* Create a new cleanup level if necessary. */
Index: lex.c
===================================================================
--- lex.c (revision 247636)
+++ lex.c (working copy)
@@ -447,13 +447,9 @@ unqualified_name_lookup_error (tree name
this NAME in the innermost block scope. */
if (local_bindings_p ())
{
- tree decl;
- decl = build_decl (loc, VAR_DECL, name, error_mark_node);
- DECL_CONTEXT (decl) = current_function_decl;
- push_local_binding (name, decl, 0);
- /* Mark the variable as used so that we do not get warnings
- about it being unused later. */
- TREE_USED (decl) = 1;
+ tree decl = build_decl (loc, VAR_DECL, name, error_mark_node);
+ TREE_USED (decl) = true;
+ pushdecl (decl);
}
}