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] Fix profiledbootstrap ada checking failure (PR debug/79255)


> The following C testcase shows how profiledbootstrap fails with checking
> compiler.  We have a (nested) FUNCTION_DECL inside of BLOCK_VARS of an
> inline function, when it gets inlined, it is moved into
> BLOCK_NONLOCALIZED_VARS.  And, decls_for_scope calls process_scope_var
> with NULL decl and non-NULL origin for all BLOCK_NONLOCALIZED_VARS.
> That is fine for variables, but for FUNCTION_DECLs it can actually
> try to dwarf2out_abstract_function that FUNCTION_DECL, which should be
> really done only when it is inlined (i.e. BLOCK_ABSTRACT_ORIGIN of
> some BLOCK).  The effect is that we actually add DW_AT_inline attribute
> to that DW_TAG_subroutine, and then later when processing it again
> we add DW_AT_low_pc etc. and ICE, because those attributes should not
> appear on DW_AT_inline functions.
> 
> Fixed by handling FUNCTION_DECLs always the same, whether in BLOCK_VARS
> or BLOCK_NONLOCALIZED_VARS.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> 2017-03-23  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR debug/79255
> 	* dwarf2out.c (decls_for_scope): If BLOCK_NONLOCALIZED_VAR is
> 	a FUNCTION_DECL, pass it as decl instead of origin to
> 	process_scope_var.

Thanks for working on this, however the patch breaks bootstrap for us in stage 
#2 using a different set of bootstrap options (-gnatpgn -g).  There appears to 
be an endless recursion :

[...]

#27 0x0000000000b7c929 in process_scope_var (stmt=0x7ffff42ebf60, 
    decl=0x7ffff3c01700, origin=0x0, context_die=0x7fffe2ddd870)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:24833
#28 0x0000000000b7ca6f in decls_for_scope (stmt=0x7ffff42ebf60, 
    context_die=0x7fffe2ddd870)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:24867
#29 0x0000000000b77e78 in gen_lexical_block_die (stmt=0x7ffff42ebf60, 
    context_die=0x7fffe2ddd6e0)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:23207
#30 0x0000000000b7c638 in gen_block_die (stmt=0x7ffff42ebf60, 
    context_die=0x7fffe2ddd6e0)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:24795
#31 0x0000000000b7cb07 in decls_for_scope (stmt=0x7ffff42ebde0, 
    context_die=0x7fffe2ddd6e0)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:24881
#32 0x0000000000b78017 in gen_inlined_subroutine_die (stmt=0x7ffff42ebde0, 
    context_die=0x7fffe2ddd1e0)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:23245
#33 0x0000000000b7c623 in gen_block_die (stmt=0x7ffff42ebde0, 
    context_die=0x7fffe2ddd1e0)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:24792
#34 0x0000000000b7cb07 in decls_for_scope (stmt=0x7ffff449e000, 
---Type <return> to continue, or q <return> to quit---
    context_die=0x7fffe2ddd1e0)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:24881
#35 0x0000000000b7c64d in gen_block_die (stmt=0x7ffff449e000, 
    context_die=0x7fffe2ddd1e0)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:24798
#36 0x0000000000b7cb07 in decls_for_scope (stmt=0x7ffff3f7bf00, 
    context_die=0x7fffe2ddd1e0)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:24881
#37 0x0000000000b77e78 in gen_lexical_block_die (stmt=0x7ffff3f7bf00, 
    context_die=0x7fffe2ddaeb0)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:23207
#38 0x0000000000b7c638 in gen_block_die (stmt=0x7ffff3f7bf00, 
    context_die=0x7fffe2ddaeb0)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:24795
#39 0x0000000000b7cb07 in decls_for_scope (stmt=0x7ffff3bf98a0, 
    context_die=0x7fffe2ddaeb0)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:24881
#40 0x0000000000b72766 in gen_subprogram_die (decl=0x7ffff3c01700, 
    context_die=0x7fffe2ddae60)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:22441
#41 0x0000000000b7e034 in gen_decl_die (decl=0x7ffff3c01700, origin=0x0, 
    ctx=0x0, context_die=0x7fffe2ddae60)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:25289
#42 0x0000000000b7c929 in process_scope_var (stmt=0x7ffff42ebf60, 
    decl=0x7ffff3c01700, origin=0x0, context_die=0x7fffe2ddae60)
    at /home/eric/gnat/gnat-head/src/gcc/dwarf2out.c:24833

[...]

We have local modifications in the Ada front-end so I cannot reproduce it with 
the pristine tree either. :-(  I'll try harder tomorrow.

-- 
Eric Botcazou


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