aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-nested.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-nested.c')
-rw-r--r--gcc/tree-nested.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 6d1b501..df6923f 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -1331,6 +1331,25 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
if (!optimize && gimple_bind_block (stmt))
note_nonlocal_block_vlas (info, gimple_bind_block (stmt));
+ for (tree var = gimple_bind_vars (stmt); var; var = DECL_CHAIN (var))
+ if (TREE_CODE (var) == NAMELIST_DECL)
+ {
+ /* Adjust decls mentioned in NAMELIST_DECL. */
+ tree decls = NAMELIST_DECL_ASSOCIATED_DECL (var);
+ tree decl;
+ unsigned int i;
+
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (decls), i, decl)
+ {
+ if (TREE_CODE (decl) == VAR_DECL
+ && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
+ continue;
+ if (decl_function_context (decl) != info->context)
+ CONSTRUCTOR_ELT (decls, i)->value
+ = get_nonlocal_debug_decl (info, decl);
+ }
+ }
+
*handled_ops_p = false;
return NULL_TREE;
@@ -1787,6 +1806,36 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
*handled_ops_p = false;
return NULL_TREE;
+ case GIMPLE_BIND:
+ for (tree var = gimple_bind_vars (stmt); var; var = DECL_CHAIN (var))
+ if (TREE_CODE (var) == NAMELIST_DECL)
+ {
+ /* Adjust decls mentioned in NAMELIST_DECL. */
+ tree decls = NAMELIST_DECL_ASSOCIATED_DECL (var);
+ tree decl;
+ unsigned int i;
+
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (decls), i, decl)
+ {
+ if (TREE_CODE (decl) == VAR_DECL
+ && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
+ continue;
+ if (decl_function_context (decl) == info->context
+ && !use_pointer_in_frame (decl))
+ {
+ tree field = lookup_field_for_decl (info, decl, NO_INSERT);
+ if (field)
+ {
+ CONSTRUCTOR_ELT (decls, i)->value
+ = get_local_debug_decl (info, decl, field);
+ }
+ }
+ }
+ }
+
+ *handled_ops_p = false;
+ return NULL_TREE;
+
default:
/* For every other statement that we are not interested in
handling here, let the walker traverse the operands. */