From a036f8d87bc668bb6c8ed51444ee2677f1173f4a Mon Sep 17 00:00:00 2001 From: bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Tue, 6 Apr 1999 14:27:19 +0000 Subject: [PATCH] =?UTF-8?q?=EF=BF=BD=20=09*=20parse.y=20(patch=5Fbinop):?= =?UTF-8?q?=20=20Don't=20fold=20if=20non-constant=20and=20emiting=20=09cla?= =?UTF-8?q?ss=20files.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26215 138bc75d-0d04-0410-961f-82ee72b054a4 --- 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 c402f12a7c51..69f18618b724 100644 --- a/gcc/java/parse.c +++ b/gcc/java/parse.c @@ -11971,8 +11971,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; } -- GitLab