------- Comment #3 from rguenth at gcc dot gnu dot org 2006-04-22 13:08 ------- The problem is we expand the value in QI mode because of
val = builtin_save_expr (val); len = builtin_save_expr (len); len_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0); dest_mem = get_memory_rtx (dest, len); if (TREE_CODE (val) != INTEGER_CST) { tree cval; rtx val_rtx; cval = fold_build1 (CONVERT_EXPR, unsigned_char_type_node, val); val_rtx = expand_expr (cval, NULL_RTX, VOIDmode, 0); The "easiest" solution is something like Index: gcc/builtins.c =================================================================== *** gcc/builtins.c (revision 113168) --- gcc/builtins.c (working copy) *************** expand_builtin_memset (tree arglist, rtx *** 3437,3442 **** --- 3437,3443 ---- /* Stabilize the arguments in case we fail. */ dest = builtin_save_expr (dest); val = builtin_save_expr (val); + expand_expr (val, NULL_RTX, VOIDmode, 0); len = builtin_save_expr (len); len_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0); which forces expansion in the original mode. This may be not the best fix though, as we then get (subreg:QI (reg:SI)) for the expansion of cval. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27260