From 7c952a134f8d980ba797daee972c41f18d449c5d Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Mon, 19 May 2008 21:42:48 +0000 Subject: * tree.c (substitute_in_expr) : Fix thinko. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135582 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 5a0656c67ac..18a9460d063 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2516,8 +2516,7 @@ substitute_in_expr (tree exp, tree f, tree r) { enum tree_code code = TREE_CODE (exp); tree op0, op1, op2, op3; - tree new; - tree inner; + tree new, inner; /* We handle TREE_LIST and COMPONENT_REF separately. */ if (code == TREE_LIST) @@ -2627,13 +2626,15 @@ substitute_in_expr (tree exp, tree f, tree r) for (i = 1; i < TREE_OPERAND_LENGTH (exp); i++) { tree op = TREE_OPERAND (exp, i); - tree newop = SUBSTITUTE_IN_EXPR (op, f, r); - if (newop != op) + tree new_op = SUBSTITUTE_IN_EXPR (op, f, r); + if (new_op != op) { - copy = copy_node (exp); - TREE_OPERAND (copy, i) = newop; + if (!copy) + copy = copy_node (exp); + TREE_OPERAND (copy, i) = new_op; } } + if (copy) new = fold (copy); else -- cgit v1.2.1