This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Java: expand BLOCK


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]