Richard Sandiford <rdsandif...@googlemail.com> writes:

> Index: gcc/auto-inc-dec.c
> ===================================================================
> --- gcc/auto-inc-dec.c        2014-06-14 20:08:31.421565177 +0100
> +++ gcc/auto-inc-dec.c        2014-06-14 20:08:33.433584004 +0100
> @@ -969,7 +969,7 @@ find_inc (bool first_try)
>    rtx insn;
>    basic_block bb = BLOCK_FOR_INSN (mem_insn.insn);
>    rtx other_insn;
> -  df_ref *def_rec;
> +  df_ref def;
>  
>    /* Make sure this reg appears only once in this insn.  */
>    if (count_occurrences (PATTERN (mem_insn.insn), mem_insn.reg0, 1) != 1)
> @@ -1013,9 +1013,8 @@ find_inc (bool first_try)
>  
>    /* Need to assure that none of the operands of the inc instruction are
>       assigned to by the mem insn.  */
> -  for (def_rec = DF_INSN_DEFS (mem_insn.insn); *def_rec; def_rec++)
> +  FOR_EACH_INSN_DEF (def, mem_insn.insn)
>      {
> -      df_ref def = *def_rec;
>        unsigned int regno = DF_REF_REGNO (def);
>        if ((regno == REGNO (inc_insn.reg0))
>         || (regno == REGNO (inc_insn.reg_res)))
> @@ -1342,7 +1341,7 @@ merge_in_block (int max_reg, basic_block
>  
>    FOR_BB_INSNS_REVERSE_SAFE (bb, insn, curr)
>      {
> -      unsigned int uid = INSN_UID (insn);
> +      df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
>        bool insn_is_add_or_inc = true;
>  
>        if (!NONDEBUG_INSN_P (insn))
> @@ -1418,22 +1417,20 @@ merge_in_block (int max_reg, basic_block
>  
>        /* If the inc insn was merged with a mem, the inc insn is gone
>        and there is noting to update.  */
> -      if (DF_INSN_UID_GET (uid))
> +      if (insn_info)

This is wrong.  As the comment explains, the insn may already be
recycled, and you use a stale pointer.  Since insn_info is a local
variable, it cannot reflect that fact.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

Reply via email to