]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/6963 (Linux kernel miscompile due to clobbered MEM_SIZE)
authorUlrich Weigand <uweigand@de.ibm.com>
Sat, 22 Jun 2002 14:29:26 +0000 (14:29 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Sat, 22 Jun 2002 14:29:26 +0000 (14:29 +0000)
PR middle-end/6963
* function.c (assign_stack_temp_for_type): Do not return
the same MEM rtx for multiple uses of a stack slot.

From-SVN: r54913

gcc/ChangeLog
gcc/function.c

index bf92a1b146401a6b8c331a9b62da4edd34e1d66b..32d5119fe5fc7b21633abface650f3bd7aea3f75 100644 (file)
@@ -1,3 +1,9 @@
+2002-06-22  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       PR middle-end/6963
+       * function.c (assign_stack_temp_for_type): Do not return
+       the same MEM rtx for multiple uses of a stack slot.
+
 2002-06-22  David S. Miller  <davem@redhat.com>
 
        PR target/6841 target/6770 target/6719
index 72c64a0592574fb50ceb3f91b8fcaf04dba57cf8..9ddf676b5aba4cdb2d0bcdae662a6002e1f45df5 100644 (file)
@@ -666,6 +666,7 @@ assign_stack_temp_for_type (mode, size, keep, type)
 {
   unsigned int align;
   struct temp_slot *p, *best_p = 0;
+  rtx slot;
 
   /* If SIZE is -1 it means that somebody tried to allocate a temporary
      of a variable size.  */
@@ -811,29 +812,26 @@ assign_stack_temp_for_type (mode, size, keep, type)
       p->keep = keep;
     }
 
-  /* We may be reusing an old slot, so clear any MEM flags that may have been
-     set from before.  */
-  RTX_UNCHANGING_P (p->slot) = 0;
-  MEM_IN_STRUCT_P (p->slot) = 0;
-  MEM_SCALAR_P (p->slot) = 0;
-  MEM_VOLATILE_P (p->slot) = 0;
-  set_mem_alias_set (p->slot, 0);
+
+  /* Create a new MEM rtx to avoid clobbering MEM flags of old slots.  */
+  slot = gen_rtx_MEM (mode, XEXP (p->slot, 0));
+  stack_slot_list = gen_rtx_EXPR_LIST (VOIDmode, slot, stack_slot_list);
 
   /* If we know the alias set for the memory that will be used, use
      it.  If there's no TYPE, then we don't know anything about the
      alias set for the memory.  */
-  set_mem_alias_set (p->slot, type ? get_alias_set (type) : 0);
-  set_mem_align (p->slot, align);
+  set_mem_alias_set (slot, type ? get_alias_set (type) : 0);
+  set_mem_align (slot, align);
 
   /* If a type is specified, set the relevant flags.  */
   if (type != 0)
     {
-      RTX_UNCHANGING_P (p->slot) = TYPE_READONLY (type);
-      MEM_VOLATILE_P (p->slot) = TYPE_VOLATILE (type);
-      MEM_SET_IN_STRUCT_P (p->slot, AGGREGATE_TYPE_P (type));
+      RTX_UNCHANGING_P (slot) = TYPE_READONLY (type);
+      MEM_VOLATILE_P (slot) = TYPE_VOLATILE (type);
+      MEM_SET_IN_STRUCT_P (slot, AGGREGATE_TYPE_P (type));
     }
 
-  return p->slot;
+  return slot;
 }
 
 /* Allocate a temporary stack slot and record it for possible later