This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lto] fix error in dwarf2out_finish


On 12/7/07, Nathan Froyd <froydnj@codesourcery.com> wrote:
> We were asserting because things didn't expect to see BLOCKs as the
> context of something.  Fixed thusly.
>

Blocks are a valid context of something.
That's why we have gen_block_die, and gen_lexical_block_die.

Flat out ignoring  them is the wrong thing to do.

> Committed to the LTO branch.
>
> -Nathan
>
> 2007-12-07  Nathan Froyd  <froydnj@codesourcery.com>
>
>         * dwarf2out.c (containing_decl_for_block): New function.
>         (force_block_die): Call it.
>         (dwarf2out_finish): Call it if we have a BLOCK for our context.
>
> Index: gcc/dwarf2out.c
> ===================================================================
> --- gcc/dwarf2out.c     (revision 130658)
> +++ gcc/dwarf2out.c     (working copy)
> @@ -13498,10 +13498,10 @@ force_die_for_context (tree context)
>    gcc_unreachable ();
>  }
>
> -/* Returns the DIE for block.  A DIE will always be returned.  */
> +/* Returns the containing DECL for block.  A DECL will always be returned.  */
>
> -static dw_die_ref
> -force_block_die (tree block)
> +static tree
> +containing_decl_for_block (tree block)
>  {
>    tree context = block;
>
> @@ -13518,7 +13518,15 @@ force_block_die (tree block)
>
>    gcc_assert (context);
>
> -  return force_decl_die (context);
> +  return context;
> +}
> +
> +/* Returns the DIE for block.  A DIE will always be returned.  */
> +
> +static dw_die_ref
> +force_block_die (tree block)
> +{
> +  return force_decl_die (containing_decl_for_block (block));
>  }
>
>  /* Returns the DIE for decl.  A DIE will always be returned.  */
> @@ -14929,6 +14937,9 @@ dwarf2out_finish (const char *filename)
>               else if (TYPE_P (node->created_for))
>                 context = TYPE_CONTEXT (node->created_for);
>
> +             if (TREE_CODE (context) == BLOCK)
> +               context = containing_decl_for_block (context);
> +
>               gcc_assert (context
>                           && (TREE_CODE (context) == FUNCTION_DECL
>                               || TREE_CODE (context) == NAMESPACE_DECL));
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]