This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Java: expand BLOCK
- To: egcs-patches at egcs dot cygnus dot com
- Subject: [PATCH] Java: expand BLOCK
- From: Andrew Haley <aph at pasanda dot cygnus dot co dot uk>
- Date: 15 Jul 1999 12:19:11 -0000
This patch prevents java_lang_expand_expr from returning the value of
the last statement in a block as the block's value. In Java, blocks
cannot have a value, and several parts of the compiler assume that
this can never occur.
I have applied this patch.
Andrew.
1999-07-14 Andrew Haley <aph@cygnus.com>
* expr.c (expand_expr): Do not return the last statement in a
block as the block's value.
Index: expr.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/java/expr.c,v
retrieving revision 1.39
diff -p -2 -c -r1.39 expr.c
*** expr.c 1999/07/07 13:10:56 1.39
--- expr.c 1999/07/15 12:10:44
*************** java_lang_expand_expr (exp, target, tmod
*** 1896,1900 ****
tree local;
tree body = BLOCK_EXPR_BODY (exp);
- struct rtx_def *to_return;
pushlevel (2); /* 2 and above */
expand_start_bindings (0);
--- 1896,1899 ----
*************** java_lang_expand_expr (exp, target, tmod
*** 1914,1921 ****
body = TREE_OPERAND (body, 1);
}
! to_return = expand_expr (body, target, tmode, modifier);
poplevel (1, 1, 0);
expand_end_bindings (getdecls (), 1, 0);
! return to_return;
}
break;
--- 1913,1921 ----
body = TREE_OPERAND (body, 1);
}
! expand_expr (body, const0_rtx, VOIDmode, 0);
! emit_queue ();
poplevel (1, 1, 0);
expand_end_bindings (getdecls (), 1, 0);
! return const0_rtx;
}
break;