gcc.c-torture/execute/builtins/memops-asm.c fails on sh-elf with -O1 and higher. It seems that bcopy is converted to memcpy even when source and destination area are overlapped. It looks same tests start to fail also on ia64 and s390 testresults. They don't fail on i686, but a similar testcase typedef __SIZE_TYPE__ size_t; extern void abort (void); extern void bcopy (const void *, void *, size_t); extern int memcmp (const void *, const void *, size_t); char y[64] = "foXXXrfoobar"; int main () { bcopy (y + 1, y + 2, 6); if (memcmp (y, "fooXXXrfobar", 13)) abort (); return 0; } aborts with -O1 on i686-pc-linux-gnu for revision 119302. If the resent changes of builtins.c in r119292 and r119294 are reverted, the errors go away.
This is honza again.
Subject: Re: [4.3 Regression] bcopy is wrongly converted to memcpy Hi, there is nice typo on the check validating the transformation. I am testing the patch and will commit it as obvious if it passes. Honza Index: builtins.c =================================================================== --- builtins.c (revision 119360) +++ builtins.c (working copy) @@ -8176,7 +8176,7 @@ fold_builtin_memory_op (tree arglist, tr if (dest_align && src_align && (readonly_data_expr (src) || (host_integerp (len, 1) - && (MIN (src_align, dest_align) / BITS_PER_UNIT <= + && (MIN (src_align, dest_align) / BITS_PER_UNIT >= tree_low_cst (len, 1))))) { tree fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
This also fails for spu-elf. Confirmed. http://gcc.gnu.org/ml/gcc-testresults/2006-11/msg01291.html
Subject: Bug 30028 Author: hubicka Date: Thu Nov 30 19:36:02 2006 New Revision: 119375 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119375 Log: PR middle-end/30028 * builtins.c (fold_builtin_memory_op): Fix typo in the check for memmove/bcopy->memcpy conversion. Modified: trunk/gcc/ChangeLog trunk/gcc/builtins.c
Confirmed fixed.
Subject: Bug number PR30028 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00499.html