From: Jason Merrill Date: Tue, 13 May 2003 17:05:35 +0000 (-0400) Subject: typeck.c (build_modify_expr): Don't always stabilize the lhs and rhs. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a65cddcf3959175275b11b9caedbe71a5d25ebe5;p=gcc.git typeck.c (build_modify_expr): Don't always stabilize the lhs and rhs. * typeck.c (build_modify_expr): Don't always stabilize the lhs and rhs. Do stabilize the lhs of a MODIFY_EXPR used on the lhs. From-SVN: r66766 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8e19ceec6cd..f375a4f8205 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2003-05-13 Jason Merrill + + * typeck.c (build_modify_expr): Don't always stabilize the lhs and + rhs. Do stabilize the lhs of a MODIFY_EXPR used on the lhs. + 2003-05-11 Kriang Lerdsuwanakij * method.c (synthesize_method): Call push/pop_deferring_access_checks. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 20e602a883e..833d169a101 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5336,6 +5336,10 @@ build_modify_expr (lhs, modifycode, rhs) TREE_OPERAND (lhs, 0), newrhs); case MODIFY_EXPR: + if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0))) + lhs = build (TREE_CODE (lhs), TREE_TYPE (lhs), + stabilize_reference (TREE_OPERAND (lhs, 0)), + TREE_OPERAND (lhs, 1)); newrhs = build_modify_expr (TREE_OPERAND (lhs, 0), modifycode, rhs); if (newrhs == error_mark_node) return error_mark_node; @@ -5541,14 +5545,6 @@ build_modify_expr (lhs, modifycode, rhs) } } - if (TREE_CODE (lhstype) != REFERENCE_TYPE) - { - if (TREE_SIDE_EFFECTS (lhs)) - lhs = stabilize_reference (lhs); - if (TREE_SIDE_EFFECTS (newrhs)) - newrhs = stabilize_reference (newrhs); - } - /* Convert new value to destination type. */ if (TREE_CODE (lhstype) == ARRAY_TYPE)