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]
Other format: [Raw text]

[PATCH] Fix PR40015


This fixes PR40015 where we no longer folded a memcpy to an array
copy.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2009-05-04  Richard Guenther  <rguenther@suse.de>

	PR middle-end/40015
	* builtins.c (fold_builtin_memory_op): Do not decay to element
	type if the size matches the whole array.

Index: gcc/builtins.c
===================================================================
*** gcc/builtins.c	(revision 147092)
--- gcc/builtins.c	(working copy)
*************** fold_builtin_memory_op (tree dest, tree
*** 8970,8976 ****
  	}
        srctype = TREE_TYPE (TREE_TYPE (src));
        if (srctype
! 	  && TREE_CODE (srctype) == ARRAY_TYPE)
  	{
  	  srctype = TREE_TYPE (srctype);
  	  STRIP_NOPS (src);
--- 8970,8977 ----
  	}
        srctype = TREE_TYPE (TREE_TYPE (src));
        if (srctype
! 	  && TREE_CODE (srctype) == ARRAY_TYPE
! 	  && !tree_int_cst_equal (TYPE_SIZE_UNIT (srctype), len))
  	{
  	  srctype = TREE_TYPE (srctype);
  	  STRIP_NOPS (src);
*************** fold_builtin_memory_op (tree dest, tree
*** 8978,8984 ****
  	}
        desttype = TREE_TYPE (TREE_TYPE (dest));
        if (desttype
! 	  && TREE_CODE (desttype) == ARRAY_TYPE)
  	{
  	  desttype = TREE_TYPE (desttype);
  	  STRIP_NOPS (dest);
--- 8979,8986 ----
  	}
        desttype = TREE_TYPE (TREE_TYPE (dest));
        if (desttype
! 	  && TREE_CODE (desttype) == ARRAY_TYPE
! 	  && !tree_int_cst_equal (TYPE_SIZE_UNIT (desttype), len))
  	{
  	  desttype = TREE_TYPE (desttype);
  	  STRIP_NOPS (dest);


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