2003-09-12  Andrew Haley  <aph@redhat.com>

	* java-tree.h (LOCAL_VAR_OUT_OF_SCOPE_P): New.
	(struct lang_decl_var:freed): New variable. 
	* decl.c (poplevel): Mark local vars that have gone out of scope.
	(push_jvm_slot): Don't use the RTL of a var that has gone out of
	scope.

*** gcc/java/java-tree.h~	Fri Sep 12 15:56:46 2003
--- gcc/java/java-tree.h	Fri Sep 12 16:08:16 2003
*************** union lang_tree_node 
*** 931,934 ****
--- 931,937 ----
  #define LOCAL_CLASS_INITIALIZATION_FLAG_P(NODE) \
      (DECL_LANG_SPECIFIC (NODE) && LOCAL_CLASS_INITIALIZATION_FLAG(NODE))
+ /* True if NODE is a variable that is out of scope.  */
+ #define LOCAL_VAR_OUT_OF_SCOPE_P(NODE) \
+     (DECL_LANG_SPECIFIC(NODE)->u.v.freed)
  /* Create a DECL_LANG_SPECIFIC if necessary. */
  #define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T)			\
*************** struct lang_decl_var GTY(())
*** 1015,1018 ****
--- 1018,1022 ----
    unsigned int final_iud : 1;	/* Final initialized upon declaration */
    unsigned int cif : 1;		/* True: decl is a class initialization flag */
+   unsigned int freed : 1;	/* Decl is no longer in scope.  */
  };
  
*** gcc/java/decl.c~	Wed Jun  4 09:41:23 2003
--- gcc/java/decl.c	Fri Sep 12 16:06:02 2003
*************** push_jvm_slot (int index, tree decl)
*** 118,122 ****
    while (tmp != NULL_TREE)
      {
!       if (TYPE_MODE (type) == TYPE_MODE (TREE_TYPE (tmp)))
  	rtl = DECL_RTL_IF_SET (tmp);
        if (rtl != NULL)
--- 118,123 ----
    while (tmp != NULL_TREE)
      {
!       if (TYPE_MODE (type) == TYPE_MODE (TREE_TYPE (tmp))
! 	  && ! LOCAL_VAR_OUT_OF_SCOPE_P (tmp))
  	rtl = DECL_RTL_IF_SET (tmp);
        if (rtl != NULL)
*************** poplevel (int keep, int reverse, int fun
*** 1268,1271 ****
--- 1269,1273 ----
  
    for (decl = decls; decl; decl = TREE_CHAIN (decl))
+     {
        if (TREE_CODE (decl) == FUNCTION_DECL
  	  && ! TREE_ASM_WRITTEN (decl)
*************** poplevel (int keep, int reverse, int fun
*** 1273,1282 ****
  	&& TREE_ADDRESSABLE (decl))
        {
! 	/* If this decl was copied from a file-scope decl
! 	   on account of a block-scope extern decl,
! 	   propagate TREE_ADDRESSABLE to the file-scope decl.
! 
! 	   DECL_ABSTRACT_ORIGIN can be set to itself if warn_return_type is
! 	   true, since then the decl goes through save_for_inline_copying.  */
  	if (DECL_ABSTRACT_ORIGIN (decl) != 0
  	    && DECL_ABSTRACT_ORIGIN (decl) != decl)
--- 1275,1285 ----
  	  && TREE_ADDRESSABLE (decl))
  	{
! 	  /* If this decl was copied from a file-scope decl on account
! 	     of a block-scope extern decl, propagate TREE_ADDRESSABLE
! 	     to the file-scope decl.
! 	     
! 	     DECL_ABSTRACT_ORIGIN can be set to itself if
! 	     warn_return_type is true, since then the decl goes
! 	     through save_for_inline_copying.  */
  	  if (DECL_ABSTRACT_ORIGIN (decl) != 0
  	      && DECL_ABSTRACT_ORIGIN (decl) != decl)
*************** poplevel (int keep, int reverse, int fun
*** 1289,1292 ****
--- 1292,1300 ----
  	    }
  	}
+       else if (TREE_CODE (decl) == VAR_DECL
+ 	       && DECL_LANG_SPECIFIC (decl) != NULL
+ 	       && DECL_LOCAL_SLOT_NUMBER (decl))
+ 	LOCAL_VAR_OUT_OF_SCOPE_P (decl) = 1;
+     }
  
    /* If there were any declarations in that level,
