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: [PATCH] Proper use of decl_function_context in dwar2out.c


On Thu, Mar 8, 2012 at 12:18 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Mar 08, 2012 at 12:06:46PM +0100, Martin Jambor wrote:
>> ? ? ? ?/* For local statics lookup proper context die. ?*/
>> - ? ? ?if (TREE_STATIC (decl) && decl_function_context (decl))
>> - ? ? context_die = lookup_decl_die (DECL_CONTEXT (decl));
>> + ? ? ?if (TREE_STATIC (decl) &&
>> + ? ? ? (ctx_fndecl = decl_function_context (decl)) != NULL_TREE)
>> + ? ? context_die = lookup_decl_die (ctx_fndecl);
>
> The formatting is wrong, && shouldn't be at the end of line.
> For the rest I'll defer to Jason, not sure what exactly we want to do there.
> This hunk has been added by Honza:

I don't think the patch is right.  Suppose you have a function-local
class declaration with a static member.  Surely the context DIE
you want to use is still the class one, not the function one.

So, I'm not sure why we should not be able to create a testcase
that fails even without LTO.  I think using get_context_die here
would be more appropriate.  Or restrict this to DECL_CONTEXT (decl)
== FUNCTION_DECL.

Richard.

> 2005-06-09 ?Jan Hubicka ?<jh@suse.cz>
>
> ? ? ? ?* cgraphunit.c (cgraph_create_edges): Do not walk BLOCK; finalize
> ? ? ? ?local statics when doing unit-at-a-time.
> ? ? ? ?(cgraph_varpool_assemble_pending_decls): Output debug info.
> ? ? ? ?* dwarf2out.c (decls_for_scope): Skip local statics.
> ? ? ? ?(dwarf2out_decl): Handle local statics.
> ? ? ? ?* passes.c (rest_of_decl_compilation): Do not differentiate
> ? ? ? ?local and global statics in unit-at-a-time.
> ? ? ? ?* tree-inline.c (remap_decls): Put local static into
> ? ? ? ?unexpanded_vars_list rather than introducing duplicated VAR_DECL
> ? ? ? ?node.
>
> ? ? ? ?Jakub


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