diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1212a519ecfdc4f53a6530e739c06cf5efe1b817..4929dd466e3c485b79f4caa1c3817df79ab862a4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+Fri Aug 17 15:48:57 CEST 2001  Jan Hubicka  <jh@suse.cz>
+
+	Install the proper patch.
+	* function.c (put_var_into_stack): Temporarily clear DECL_RTL.
+	(assign_params): Avoid setting DECL_RTL to unfinished RTX.
+	(expand_function_start): Likewise.
+	* stmt.c (expand_decl): Likewise.
+	* varasm.c (make_decl_rtx): Likewise.
+
 Fri Aug 17 15:41:35 CEST 2001  Jan Hubicka  <jh@suse.cz>
 
 	* final.c: Undo my previous accidental checkin.
diff --git a/gcc/function.c b/gcc/function.c
index 450c400a4c5bc868edeef12ed7d470ab9ce8f554..0a6ed73b52e77236a1567979382e3c2d9e98795e 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1420,7 +1420,14 @@ put_var_into_stack (decl)
 
       /* Change the CONCAT into a combined MEM for both parts.  */
       PUT_CODE (reg, MEM);
+
+      /* set_mem_attributes uses DECL_RTL to avoid re-generating of
+         already computed alias sets.  Here we want to re-generate.  */
+      if (DECL_P (decl))
+	SET_DECL_RTL (decl, NULL);
       set_mem_attributes (reg, decl, 1);
+      if (DECL_P (decl))
+	SET_DECL_RTL (decl, reg);
 
       /* The two parts are in memory order already.
 	 Use the lower parts address as ours.  */
@@ -4688,10 +4695,10 @@ assign_parms (fndecl)
 	     appropriately.  */
 	  if (passed_pointer)
 	    {
-	      SET_DECL_RTL (parm,
-			    gen_rtx_MEM (TYPE_MODE (TREE_TYPE (passed_type)), 
-					 parmreg));
-	      set_mem_attributes (DECL_RTL (parm), parm, 1);
+	      rtx x = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (passed_type)),
+			     	   parmreg);
+	      set_mem_attributes (x, parm, 1);
+	      SET_DECL_RTL (parm, x);
 	    }
 	  else
 	    {
@@ -5030,11 +5037,10 @@ assign_parms (fndecl)
       if (parm == function_result_decl)
 	{
 	  tree result = DECL_RESULT (fndecl);
+	  rtx x = gen_rtx_MEM (DECL_MODE (result), DECL_RTL (parm));
 
-	  SET_DECL_RTL (result,
-			gen_rtx_MEM (DECL_MODE (result), DECL_RTL (parm)));
-
-	  set_mem_attributes (DECL_RTL (result), result, 1);
+	  set_mem_attributes (x, result, 1);
+	  SET_DECL_RTL (result, x);
 	}
     }
 
@@ -6451,11 +6457,9 @@ expand_function_start (subr, parms_have_cleanups)
 	}
       if (value_address)
 	{
-	  SET_DECL_RTL (DECL_RESULT (subr),
-			gen_rtx_MEM (DECL_MODE (DECL_RESULT (subr)), 
-				     value_address));
-	  set_mem_attributes (DECL_RTL (DECL_RESULT (subr)),
-			      DECL_RESULT (subr), 1);
+	  rtx x = gen_rtx_MEM (DECL_MODE (DECL_RESULT (subr)), value_address);
+	  set_mem_attributes (x, DECL_RESULT (subr), 1);
+	  SET_DECL_RTL (DECL_RESULT (subr), x);
 	}
     }
   else if (DECL_MODE (DECL_RESULT (subr)) == VOIDmode)
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 593fe4de4dac2029438ba158d6ed9a07388d011d..357583d004f690763dd8bce7c010ef1d1ee5c351 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -3810,15 +3810,17 @@ expand_decl (decl)
   else if (DECL_SIZE (decl) == 0)
     /* Variable with incomplete type.  */
     {
+      rtx x;
       if (DECL_INITIAL (decl) == 0)
 	/* Error message was already done; now avoid a crash.  */
-	SET_DECL_RTL (decl, gen_rtx_MEM (BLKmode, const0_rtx));
+	x = gen_rtx_MEM (BLKmode, const0_rtx);
       else
 	/* An initializer is going to decide the size of this array.
 	   Until we know the size, represent its address with a reg.  */
-	SET_DECL_RTL (decl, gen_rtx_MEM (BLKmode, gen_reg_rtx (Pmode)));
+	x = gen_rtx_MEM (BLKmode, gen_reg_rtx (Pmode));
 
-      set_mem_attributes (DECL_RTL (decl), decl, 1);
+      set_mem_attributes (x, decl, 1);
+      SET_DECL_RTL (decl, x);
     }
   else if (DECL_MODE (decl) != BLKmode
 	   /* If -ffloat-store, don't put explicit float vars
@@ -3888,7 +3890,7 @@ expand_decl (decl)
   else
     /* Dynamic-size object: must push space on the stack.  */
     {
-      rtx address, size;
+      rtx address, size, x;
 
       /* Record the stack pointer on entry to block, if have
 	 not already done so.  */
@@ -3913,9 +3915,10 @@ expand_decl (decl)
 					      TYPE_ALIGN (TREE_TYPE (decl)));
 
       /* Reference the variable indirect through that rtx.  */
-      SET_DECL_RTL (decl, gen_rtx_MEM (DECL_MODE (decl), address));
+      x = gen_rtx_MEM (DECL_MODE (decl), address);
+      set_mem_attributes (x, decl, 1);
+      SET_DECL_RTL (decl, x);
 
-      set_mem_attributes (DECL_RTL (decl), decl, 1);
 
       /* Indicate the alignment we actually gave this variable.  */
 #ifdef STACK_BOUNDARY
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 4e39a8ad08d8d1812eb9a3cf229e60e59b902711..6cb2fb8ddfb6f5ab5082726a97178b95a3ece1aa 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -681,6 +681,7 @@ make_decl_rtl (decl, asmspec)
   const char *name = 0;
   const char *new_name = 0;
   int reg_number;
+  rtx x;
 
   /* Check that we are not being given an automatic variable.  */
   /* A weak alias has TREE_PUBLIC set but not the other bits.  */
@@ -848,11 +849,11 @@ make_decl_rtl (decl, asmspec)
 	   && (TREE_PUBLIC (decl) || TREE_STATIC (decl)))))
     TREE_SIDE_EFFECTS (decl) = 1;
 
-  SET_DECL_RTL (decl, gen_rtx_MEM (DECL_MODE (decl),
-				   gen_rtx_SYMBOL_REF (Pmode, name)));
-  SYMBOL_REF_WEAK (XEXP (DECL_RTL (decl), 0)) = DECL_WEAK (decl);
+  x = gen_rtx_MEM (DECL_MODE (decl), gen_rtx_SYMBOL_REF (Pmode, name));
+  SYMBOL_REF_WEAK (XEXP (x, 0)) = DECL_WEAK (decl);
   if (TREE_CODE (decl) != FUNCTION_DECL)
-    set_mem_attributes (DECL_RTL (decl), decl, 1);
+    set_mem_attributes (x, decl, 1);
+  SET_DECL_RTL (decl, x);
 
   /* Optionally set flags or add text to the name to record information
      such as that it is a function name.