typeck.c (build_modify_expr): Don't always stabilize the lhs and rhs.
authorJason Merrill <jason@redhat.com>
Tue, 13 May 2003 17:05:35 +0000 (13:05 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 13 May 2003 17:05:35 +0000 (13:05 -0400)
        * 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

gcc/cp/ChangeLog
gcc/cp/typeck.c

index 8e19ceec6cdd809ae1c16b5f0771abd43576f35a..f375a4f82051e63cb2d9c0768d1f15ebb73cd8eb 100644 (file)
@@ -1,3 +1,8 @@
+2003-05-13  Jason Merrill  <jason@redhat.com>
+
+       * 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  <lerdsuwa@users.sourceforge.net>
 
        * method.c (synthesize_method): Call push/pop_deferring_access_checks.
index 20e602a883e4fd70ee212fa38f00ed3fd2e0907b..833d169a1018f0681986cb966453fdba36c5f0ed 100644 (file)
@@ -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)