parse.y (patch_binop): Don't fold if non-constant and emiting class files.
authorPer Bothner <bothner@gcc.gnu.org>
Tue, 6 Apr 1999 14:27:17 +0000 (07:27 -0700)
committerPer Bothner <bothner@gcc.gnu.org>
Tue, 6 Apr 1999 14:27:17 +0000 (07:27 -0700)
h
* parse.y (patch_binop):  Don't fold if non-constant and emiting
class files.

From-SVN: r26214

gcc/java/parse.y

index 72eccbffaf39f8de92f622fa469dbb105609f249..9a343107e1548e51f082bd03fdb3692c93d73367 100644 (file)
@@ -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;
 }