On Tue, Jun 2, 2015 at 11:08 AM, Eric Botcazou <ebotca...@adacore.com> wrote:
> Hi,
>
> there is a trick in the gimplifier to alleviate some annoying effects of the
> gimplification on the debug info (for -O0 when var-tracking is not enabled but
> it's done unconditionally):
>
>   /* Try to alleviate the effects of the gimplification creating artificial
>      temporaries (see for example is_gimple_reg_rhs) on the debug info.  */
>   if (!gimplify_ctxp->into_ssa
>       && TREE_CODE (*from_p) == VAR_DECL
>       && DECL_IGNORED_P (*from_p)
>       && DECL_P (*to_p)
>       && !DECL_IGNORED_P (*to_p))
>     {
>       if (!DECL_NAME (*from_p) && DECL_NAME (*to_p))
>         DECL_NAME (*from_p)
>           = create_tmp_var_name (IDENTIFIER_POINTER (DECL_NAME (*to_p)));
>       DECL_HAS_DEBUG_EXPR_P (*from_p) = 1;
>       SET_DECL_DEBUG_EXPR (*from_p, *to_p);
>    }
>
> We have a large Ada testcase for which this creates a GC hazard in LTO mode
> because this creates a DECL_DEBUG_EXPR link between a parent and a nested
> function, which badly interacts with a DECL_VALUE_EXPR link created during
> unnesting (it's the known GC issue with circular references through hash
> tables in GC memory).
>
> Therefore the attached patch restricts the trick to local variables only.
> That's transparent, modulo a benign tweak to gcc.dg/vect/vec-scal-opt.c
> because of the DECL_NAME change.
>
> Tested on x86_64-suse-linux, OK for the mainline?

Ok.

Thanks,
Richard.

>
> 2015-06-02  Eric Botcazou  <ebotca...@adacore.com>
>
>         * gimplify.c (gimplify_modify_expr): Do not create a DECL_DEBUG_EXPR 
> if
>         the target doesn't belong to the current function.
>
>
> 2015-06-02  Eric Botcazou  <ebotca...@adacore.com>
>
>         * gcc.dg/vect/vec-scal-opt.c: Adjust regexp.
>
>
> --
> Eric Botcazou

Reply via email to