http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46647
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-24 21:36:06 UTC --- If the testcase starts with int a[1]; instead of char a[4];, then: --- builtins.c.jj32010-11-19 20:56:54.000000000 +0100 +++ builtins.c2010-11-24 22:23:41.000000000 +0100 @@ -8345,7 +8345,7 @@ fold_builtin_memset (location_t loc, tre if (integer_zerop (len)) return omit_one_operand_loc (loc, type, dest, c); - if (! host_integerp (c, 1) || TREE_SIDE_EFFECTS (dest)) + if (TREE_CODE (c) != INTEGER_CST || TREE_SIDE_EFFECTS (dest)) return NULL_TREE; var = dest; @@ -8384,7 +8384,7 @@ fold_builtin_memset (location_t loc, tre if (CHAR_BIT != 8 || BITS_PER_UNIT != 8 || HOST_BITS_PER_WIDE_INT > 64) return NULL_TREE; - cval = tree_low_cst (c, 1); + cval = TREE_INT_CST_LOW (c); cval &= 0xff; cval |= cval << 8; cval |= cval << 16; should fix this. But with char a[4]; instead this isn't something that is optimized at the tree level at all, so similar change will be needed somewhere on the expander side.