http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58981
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
The real bug seems in set_storage_via_setmem in expr.c:
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
enum insn_code code = direct_optab_handler (setmem_optab, mode);
if (code != CODE_FOR_nothing
/* We don't need MODE to be narrower than
BITS_PER_HOST_WIDE_INT here because if SIZE is less than
^^^^^^^^^^^^^^^^^^^^^^ Shouldn't it be BITS_PER_WORD?
the mode mask, as it is returned by the macro, it will
definitely be less than the actual mode mask. */
&& ((CONST_INT_P (size)
&& ((unsigned HOST_WIDE_INT) INTVAL (size)
<= (GET_MODE_MASK (mode) >> 1)))
|| GET_MODE_BITSIZE (mode) >= BITS_PER_WORD))
When Pmode != word_mode, we are using word_mode for SIZE
to set memory. Shouldn't it be
GET_MODE_BITSIZE (mode) >= GET_MODE_BITSIZE (Pmode)
instead? The memory size will be less than the bits of Pmode.