[google gcc-4_8] not mapping debug expr to a deleted varpool node (issue9760043)

Xinliang David Li davidxl@google.com
Sat May 25 02:18:00 GMT 2013


On Fri, May 24, 2013 at 4:26 PM, Rong Xu <xur@google.com> wrote:
> This patch fixes a bug in exposed in LIPO build (ICE in copy tree node).
>
> Tested with bookstrap and google internal benchmarks.
>
> -Rong
>
> 2013-05-24  Rong Xu  <xur@google.com>
>         Google ref b/8963414.
>         * gcc/tree-inline.c (add_local_variables): Not map
>         to deleted debug expression.
>
> Index: gcc/tree-inline.c
> ===================================================================
> --- gcc/tree-inline.c   (revision 199128)
> +++ gcc/tree-inline.c   (working copy)
> @@ -3788,6 +3788,17 @@ add_local_variables (struct function *callee, stru
>           {
>             tree tem = DECL_DEBUG_EXPR (var);
>             bool old_regimplify = id->regimplify;
> +
> +            /* The mapped debug expression might be deleted
> +               as a varpool node (the reachbility analysis
> +               of varpool node does not check the reference
> +               from debug expressions.
> +               Set it to 0 if that's the case.  */
> +            if (L_IPO_COMP_MODE && tem &&
> +                (TREE_STATIC (tem) || DECL_EXTERNAL(tem)) &&
> +                real_varpool_node (tem) == NULL)
> +              tem = NULL;
> +
>             id->remapping_type_depth++;
>             walk_tree (&tem, copy_tree_body_r, id, NULL);
>             id->remapping_type_depth--;


IIUC, it is the real target var-decl of VAR that gets removed from
lipo's symtab thus calling real_var_pool_node later will trigger
gcc_assert. This fix just moved the assertion earlier?

It should be ok for now to just drop the debug expr if the var is
static/global.

David

>
> --
> This patch is available for review at http://codereview.appspot.com/9760043



More information about the Gcc-patches mailing list