------- Comment #5 from jakub at gcc dot gnu dot org 2009-01-03 08:46 ------- There are several issues. One is what H.J. mentioned, seen e.g. on: char buf[8] __attribute__((aligned)); char A = 'A'; int len = 1;
void __attribute__((noinline)) check (void) { if (__builtin_memcmp (buf, "\0\0A\0\0\0\0\0", 8)) __builtin_abort (); } int main () { __builtin_memset (buf + 2, A, len); check (); return 0; } with -O -mtune=pentium-m -m32. This can be fixed by adding max_size = smallest_pow2_greater_than (max_size - 1); at the start of expand_setmem_epilogue_via_loop. But another testcase with the same options that still fails is: char buf[8] __attribute__((aligned)) = "AAAAAAAA"; char A = 'A'; int len = 4; void __attribute__((noinline)) check (void) { if (__builtin_memcmp (buf, "AAAA\0\0\0\0", 8)) __builtin_abort (); } int main () { __builtin_memset (buf + 4, '\0', len); check (); return 0; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38708