http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58981

--- Comment #3 from Jan Hubicka <hubicka at ucw dot cz> ---
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58981
> 
> --- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
> The bug is in
> 
>       *count = expand_simple_binop (GET_MODE (*count), PLUS, *count,
>                                     saveddest, *count, 1, OPTAB_DIRECT);
> 
> (gdb) call debug_rtx (saveddest)
> (reg:SI 101)
> (gdb) call debug_rtx (*count)
> (reg:DI 100)
> (gdb) 
> 
> Add SImode address to DImode count to update count leads
> to count overflow. Instead, we should use mode of address
> here:
> 
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 902e169..b27bfb6 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -23139,7 +23139,7 @@
> expand_set_or_movmem_prologue_epilogue_by_misaligned_moves (rtx destmem, rtx
> src
>        if (!issetmem)
>    *srcptr = expand_simple_binop (GET_MODE (*srcptr), MINUS, *srcptr,
> saveddest,
>                *srcptr, 1, OPTAB_DIRECT);
> -      *count = expand_simple_binop (GET_MODE (*count), PLUS, *count,
> +      *count = expand_simple_binop (GET_MODE (saveddest), PLUS, *count,

This looks OK, Thanks for looking into it!
Honza

>                 saveddest, *count, 1, OPTAB_DIRECT);
>        /* We copied at most size + prolog_size.  */
>        if (*min_size > (unsigned HOST_WIDE_INT)(size + prolog_size))
> 
> -- 
> You are receiving this mail because:
> You are on the CC list for the bug.

Reply via email to