From 4fdea7b0d18f3db1ac32a72673780fb73a35473a Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Tue, 16 Mar 1999 08:25:14 -0800 Subject: [PATCH] parse.y (java_complete_lhs): Call force_evaluation_order after patch_newarray. x * parse.y (java_complete_lhs): Call force_evaluation_order after patch_newarray. (patch_binop): Don't call fold if there are side effects. From-SVN: r25807 --- gcc/java/parse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/java/parse.c b/gcc/java/parse.c index f090ca515f5..dbefe7eaf80 100644 --- a/gcc/java/parse.c +++ b/gcc/java/parse.c @@ -10491,7 +10491,8 @@ java_complete_lhs (node) /* They complete the array creation expression, if no errors were found. */ CAN_COMPLETE_NORMALLY (node) = 1; - return (flag ? error_mark_node : patch_newarray (node)); + return (flag ? error_mark_node + : force_evaluation_order (patch_newarray (node))); case NEW_CLASS_EXPR: case CALL_EXPR: @@ -11870,7 +11871,10 @@ patch_binop (node, wfl_op1, wfl_op2) TREE_TYPE (node) = prom_type; TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2); - return fold (node); + /* fold does not respect side-effect order as required for Java but not C. */ + if (! TREE_SIDE_EFFECTS (node)) + node = fold (node); + return node; } /* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non