Yury Gribov <y.gri...@samsung.com> writes:
> diff --git a/gcc/asan.c b/gcc/asan.c
> index 32f1837..acb00ea 100644
> --- a/gcc/asan.c
> +++ b/gcc/asan.c
> @@ -895,7 +895,7 @@ asan_clear_shadow (rtx shadow_mem, HOST_WIDE_INT len)
>  
>    gcc_assert ((len & 3) == 0);
>    top_label = gen_label_rtx ();
> -  addr = force_reg (Pmode, XEXP (shadow_mem, 0));
> +  addr = copy_to_reg (force_reg (Pmode, XEXP (shadow_mem, 0)));
>    shadow_mem = adjust_automodify_address (shadow_mem, SImode, addr, 0);
>    end = force_reg (Pmode, plus_constant (Pmode, addr, len));
>    emit_label (top_label);

"copy_to_mode_reg (Pmode, XEXP (shadow_mem, 0))" would be more direct.
But it looks good to me with that change FWIW.  It's certainly invalid
to be doing:

  tmp = expand_simple_binop (Pmode, PLUS, addr, gen_int_mode (4, Pmode), addr,
                             true, OPTAB_LIB_WIDEN);
  if (tmp != addr)
    emit_move_insn (addr, tmp);

with the result of force_reg.

Thanks,
Richard

Reply via email to