re PR middle-end/21894 (Invalid operand to binary operator with nested function)
PR 21894 * tree-nested.c (convert_local_reference): Save and restore val_only around component_ref and friends. Clear walk_subtrees by default. From-SVN: r102832
This commit is contained in:
parent
febfc59a95
commit
455c08cb64
@ -1,3 +1,9 @@
|
|||||||
|
2005-08-06 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
PR 21894
|
||||||
|
* tree-nested.c (convert_local_reference): Save and restore val_only
|
||||||
|
around component_ref and friends. Clear walk_subtrees by default.
|
||||||
|
|
||||||
2005-08-06 Peter O'Gorman <peter@pogma.com>
|
2005-08-06 Peter O'Gorman <peter@pogma.com>
|
||||||
|
|
||||||
PR 21366
|
PR 21366
|
||||||
|
16
gcc/testsuite/gcc.c-torture/compile/nested-2.c
Normal file
16
gcc/testsuite/gcc.c-torture/compile/nested-2.c
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/* PR 21105 */
|
||||||
|
|
||||||
|
void
|
||||||
|
CheckFile ()
|
||||||
|
{
|
||||||
|
char tagname[10];
|
||||||
|
char *a = tagname;
|
||||||
|
|
||||||
|
int validate ()
|
||||||
|
{
|
||||||
|
return (a == tagname + 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a == tagname)
|
||||||
|
validate ();
|
||||||
|
}
|
@ -950,7 +950,9 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
|
|||||||
struct walk_stmt_info *wi = data;
|
struct walk_stmt_info *wi = data;
|
||||||
struct nesting_info *info = wi->info;
|
struct nesting_info *info = wi->info;
|
||||||
tree t = *tp, field, x;
|
tree t = *tp, field, x;
|
||||||
|
bool save_val_only;
|
||||||
|
|
||||||
|
*walk_subtrees = 0;
|
||||||
switch (TREE_CODE (t))
|
switch (TREE_CODE (t))
|
||||||
{
|
{
|
||||||
case VAR_DECL:
|
case VAR_DECL:
|
||||||
@ -989,34 +991,31 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ADDR_EXPR:
|
case ADDR_EXPR:
|
||||||
{
|
save_val_only = wi->val_only;
|
||||||
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;
|
||||||
|
|
||||||
wi->val_only = false;
|
/* If we converted anything ... */
|
||||||
wi->is_lhs = false;
|
if (wi->changed)
|
||||||
wi->changed = false;
|
{
|
||||||
walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL);
|
tree save_context;
|
||||||
wi->val_only = save_val_only;
|
|
||||||
|
|
||||||
/* If we converted anything ... */
|
/* Then the frame decl is now addressable. */
|
||||||
if (wi->changed)
|
TREE_ADDRESSABLE (info->frame_decl) = 1;
|
||||||
{
|
|
||||||
tree save_context;
|
|
||||||
|
|
||||||
/* Then the frame decl is now addressable. */
|
|
||||||
TREE_ADDRESSABLE (info->frame_decl) = 1;
|
|
||||||
|
|
||||||
save_context = current_function_decl;
|
save_context = current_function_decl;
|
||||||
current_function_decl = info->context;
|
current_function_decl = info->context;
|
||||||
recompute_tree_invarant_for_addr_expr (t);
|
recompute_tree_invarant_for_addr_expr (t);
|
||||||
current_function_decl = save_context;
|
current_function_decl = save_context;
|
||||||
|
|
||||||
/* If we are in a context where we only accept values, then
|
/* If we are in a context where we only accept values, then
|
||||||
compute the address into a temporary. */
|
compute the address into a temporary. */
|
||||||
if (save_val_only)
|
if (save_val_only)
|
||||||
*tp = tsi_gimplify_val (wi->info, t, &wi->tsi);
|
*tp = tsi_gimplify_val (wi->info, t, &wi->tsi);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REALPART_EXPR:
|
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
|
/* Go down this entire nest and just look at the final prefix and
|
||||||
anything that describes the references. Otherwise, we lose track
|
anything that describes the references. Otherwise, we lose track
|
||||||
of whether a NOP_EXPR or VIEW_CONVERT_EXPR needs a simple value. */
|
of whether a NOP_EXPR or VIEW_CONVERT_EXPR needs a simple value. */
|
||||||
|
save_val_only = wi->val_only;
|
||||||
wi->val_only = true;
|
wi->val_only = true;
|
||||||
wi->is_lhs = false;
|
wi->is_lhs = false;
|
||||||
for (; handled_component_p (t); tp = &TREE_OPERAND (t, 0), t = *tp)
|
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;
|
wi->val_only = false;
|
||||||
walk_tree (tp, convert_local_reference, wi, NULL);
|
walk_tree (tp, convert_local_reference, wi, NULL);
|
||||||
|
wi->val_only = save_val_only;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user