aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Bothner <bothner@gcc.gnu.org>1999-04-06 07:27:17 -0700
committerPer Bothner <bothner@gcc.gnu.org>1999-04-06 07:27:17 -0700
commitd1472141a50b9ba3e1f8552be2b2b69a82801087 (patch)
treef4e55c626edd2c7e93de6a79b62840e6f8ef802a
parent099a9dd0c6cbc53d8c3c3799230e4321c312fbcb (diff)
downloadgcc-d1472141a50b9ba3e1f8552be2b2b69a82801087.zip
gcc-d1472141a50b9ba3e1f8552be2b2b69a82801087.tar.gz
gcc-d1472141a50b9ba3e1f8552be2b2b69a82801087.tar.bz2
parse.y (patch_binop): Don't fold if non-constant and emiting class files.
h * parse.y (patch_binop): Don't fold if non-constant and emiting class files. From-SVN: r26214
-rw-r--r--gcc/java/parse.y8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 72eccbf..9a34310 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -9370,8 +9370,12 @@ patch_binop (node, wfl_op1, wfl_op2)
TREE_TYPE (node) = prom_type;
TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
- /* fold does not respect side-effect order as required for Java but not C. */
- if (! TREE_SIDE_EFFECTS (node))
+ /* fold does not respect side-effect order as required for Java but not C.
+ * Also, it sometimes create SAVE_EXPRs which are bad when emitting
+ * bytecode.
+ */
+ if (flag_emit_class_files ? (TREE_CONSTANT (op1) && TREE_CONSTANT (op2))
+ : ! TREE_SIDE_EFFECTS (node))
node = fold (node);
return node;
}