summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-06-23 12:40:17 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-06-23 15:20:29 -0700
commit3e24ef68a9b22918c8b21b743d81bbf86f43c119 (patch)
tree4f36c16b94d97a51d319399f62f32565b9196a3b
parent8006576b3646f3ee621b38b5f27a138a50d073bf (diff)
ast_to_hir: Clone LHS derefs of assignment expressions.
-rw-r--r--ast_to_hir.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index b4692c6..613009b 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -932,7 +932,8 @@ ast_expression::hir(exec_list *instructions,
ir_rvalue *temp_rhs = new ir_expression(operations[this->oper], type,
op[0], op[1]);
- result = do_assignment(instructions, state, op[0], temp_rhs,
+ result = do_assignment(instructions, state,
+ (ir_rvalue *)op[0]->clone(NULL), temp_rhs,
this->subexpressions[0]->get_location());
type = result->type;
error_emitted = (op[0]->type->is_error());
@@ -957,7 +958,8 @@ ast_expression::hir(exec_list *instructions,
temp_rhs = new ir_expression(operations[this->oper], type,
op[0], op[1]);
- result = do_assignment(instructions, state, op[0], temp_rhs,
+ result = do_assignment(instructions, state,
+ (ir_rvalue *)op[0]->clone(NULL), temp_rhs,
this->subexpressions[0]->get_location());
type = result->type;
error_emitted = type->is_error();
@@ -1074,7 +1076,8 @@ ast_expression::hir(exec_list *instructions,
temp_rhs = new ir_expression(operations[this->oper], type,
op[0], op[1]);
- result = do_assignment(instructions, state, op[0], temp_rhs,
+ result = do_assignment(instructions, state,
+ (ir_rvalue *)op[0]->clone(NULL), temp_rhs,
this->subexpressions[0]->get_location());
type = result->type;
error_emitted = op[0]->type->is_error();
@@ -1100,10 +1103,12 @@ ast_expression::hir(exec_list *instructions,
/* Get a temporary of a copy of the lvalue before it's modified.
* This may get thrown away later.
*/
- result = get_lvalue_copy(instructions, state, op[0],
+ result = get_lvalue_copy(instructions, state,
+ (ir_rvalue *)op[0]->clone(NULL),
this->subexpressions[0]->get_location());
- (void)do_assignment(instructions, state, op[0], temp_rhs,
+ (void)do_assignment(instructions, state,
+ (ir_rvalue *)op[0]->clone(NULL), temp_rhs,
this->subexpressions[0]->get_location());
type = result->type;