aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-nested.c
diff options
context:
space:
mode:
authorrth <>2005-08-07 18:01:09 +0000
committerrth <>2005-08-07 18:01:09 +0000
commit6a35ca355be20a9f0f47face5144f409e973f9d7 (patch)
tree63297c2ddb66e06eb687d562d3b0737c555b8572 /gcc/tree-nested.c
parent03b675f8479fc56a9d9e92ad0162f825e92c33bd (diff)
PR 21894
* tree-nested.c (convert_local_reference): Save and restore val_only around component_ref and friends. Clear walk_subtrees by default.
Diffstat (limited to 'gcc/tree-nested.c')
-rw-r--r--gcc/tree-nested.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 4f6ec71c40e..45c9bfee2e0 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -950,7 +950,9 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
struct walk_stmt_info *wi = data;
struct nesting_info *info = wi->info;
tree t = *tp, field, x;
+ bool save_val_only;
+ *walk_subtrees = 0;
switch (TREE_CODE (t))
{
case VAR_DECL:
@@ -989,34 +991,31 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
break;
case ADDR_EXPR:
- {
- bool save_val_only = wi->val_only;
-
- wi->val_only = false;
- wi->is_lhs = false;
- wi->changed = false;
- walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL);
- wi->val_only = save_val_only;
+ save_val_only = wi->val_only;
+ wi->val_only = false;
+ wi->is_lhs = false;
+ wi->changed = false;
+ walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL);
+ wi->val_only = save_val_only;
- /* If we converted anything ... */
- if (wi->changed)
- {
- tree save_context;
+ /* If we converted anything ... */
+ if (wi->changed)
+ {
+ tree save_context;
- /* Then the frame decl is now addressable. */
- TREE_ADDRESSABLE (info->frame_decl) = 1;
+ /* Then the frame decl is now addressable. */
+ TREE_ADDRESSABLE (info->frame_decl) = 1;
- save_context = current_function_decl;
- current_function_decl = info->context;
- recompute_tree_invarant_for_addr_expr (t);
- current_function_decl = save_context;
-
- /* If we are in a context where we only accept values, then
- compute the address into a temporary. */
- if (save_val_only)
- *tp = tsi_gimplify_val (wi->info, t, &wi->tsi);
- }
- }
+ save_context = current_function_decl;
+ current_function_decl = info->context;
+ recompute_tree_invarant_for_addr_expr (t);
+ current_function_decl = save_context;
+
+ /* If we are in a context where we only accept values, then
+ compute the address into a temporary. */
+ if (save_val_only)
+ *tp = tsi_gimplify_val (wi->info, t, &wi->tsi);
+ }
break;
case REALPART_EXPR:
@@ -1028,6 +1027,7 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
/* Go down this entire nest and just look at the final prefix and
anything that describes the references. Otherwise, we lose track
of whether a NOP_EXPR or VIEW_CONVERT_EXPR needs a simple value. */
+ save_val_only = wi->val_only;
wi->val_only = true;
wi->is_lhs = false;
for (; handled_component_p (t); tp = &TREE_OPERAND (t, 0), t = *tp)
@@ -1055,6 +1055,7 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
}
wi->val_only = false;
walk_tree (tp, convert_local_reference, wi, NULL);
+ wi->val_only = save_val_only;
break;
default: