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]

Fix aliasing bug in builtins.c


This fixes a bug where the wrong MEM flags and alias sets are used for
some of the builtin memory fucntions ni some cases.

Tested on alphaev56-dec-osf4.0c.

Sat Nov  3 10:37:56 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* builtins.c (get_memory_rtx): Properly set MEM alias set and
	attributes.

*** builtins.c	2001/11/02 19:34:16	1.126
--- builtins.c	2001/11/03 15:15:58
*************** get_memory_rtx (exp)
*** 732,736 ****
  
    mem = gen_rtx_MEM (BLKmode, memory_address (BLKmode, addr));
-   set_mem_attributes (mem, exp, 0);
  
    /* Get an expression we can use to find the attributes to assign to MEM.
--- 732,735 ----
*************** get_memory_rtx (exp)
*** 743,754 ****
  
    if (TREE_CODE (exp) == ADDR_EXPR)
!     exp = TREE_OPERAND (exp, 0);
    else if (POINTER_TYPE_P (TREE_TYPE (exp)))
!     exp = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (exp)), exp);
!   else
!     return mem;
  
-   /* memcpy, memset and other builtin stringops can alias with anything.  */
-   set_mem_alias_set (mem, 0);
    return mem;
  }
--- 742,756 ----
  
    if (TREE_CODE (exp) == ADDR_EXPR)
!     {
!       exp = TREE_OPERAND (exp, 0);
!       set_mem_attributes (mem, exp, 0);
!     }
    else if (POINTER_TYPE_P (TREE_TYPE (exp)))
!     {
!       exp = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (exp)), exp);
!       /* memcpy, memset and other builtin stringops can alias with anything.  */
!       set_mem_alias_set (mem, 0);
!     }
  
    return mem;
  }


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