On Mon, Dec 02, 2013 at 12:05:57PM +0100, Richard Biener wrote:
> 
> The following fixes a bug in update_address_taken which fails
> to reset debug stmts which take the address of a decl we will
> rewrite into SSA form.  Our verifiers don't catch this because
> of an early out in the operand scanner which doesn't work in
> the specific case of LTO profiledbootstrap (or because we
> don't have more specific checking for this case).
> 
> Fixed like the following.
> 
> LTO profiledbootstrapped on x86_64-unknown-linux-gnu, regular
> bootstrap & regtest still running.

Taking address of a decl that is no longer addressable in debug stmts
is correct, that is how we generate DW_OP_GNU_implicit_ptr.
So I think this patch is going to cause huge amount of debug info quality
regressions.

> 2013-12-02  Richard Biener  <rguent...@suse.de>
> 
>       PR middle-end/59199
>       * tree-ssa.c (execute_update_addresses_taken): Reset debug
>       stmts that take the address of a no longer addressable decl.
> 
> Index: gcc/tree-ssa.c
> ===================================================================
> *** gcc/tree-ssa.c    (revision 205528)
> --- gcc/tree-ssa.c    (working copy)
> *************** execute_update_addresses_taken (void)
> *** 1651,1661 ****
>             {
>               tree *valuep = gimple_debug_bind_get_value_ptr (stmt);
>               tree decl;
> !             maybe_rewrite_mem_ref_base (valuep, suitable_for_renaming);
> !             decl = non_rewritable_mem_ref_base (*valuep);
>               if (decl
>                   && bitmap_bit_p (suitable_for_renaming, DECL_UID (decl)))
>                 gimple_debug_bind_reset_value (stmt);
>             }
>   
>           if (gimple_references_memory_p (stmt)
> --- 1651,1666 ----
>             {
>               tree *valuep = gimple_debug_bind_get_value_ptr (stmt);
>               tree decl;
> !             if (TREE_CODE (*valuep) == ADDR_EXPR)
> !               decl = get_base_address (TREE_OPERAND (*valuep, 0));
> !             else
> !               decl = non_rewritable_mem_ref_base (*valuep);
>               if (decl
> +                 && DECL_P (decl)
>                   && bitmap_bit_p (suitable_for_renaming, DECL_UID (decl)))
>                 gimple_debug_bind_reset_value (stmt);
> +             else
> +               maybe_rewrite_mem_ref_base (valuep, suitable_for_renaming);
>             }
>   
>           if (gimple_references_memory_p (stmt)

        Jakub

Reply via email to