Re: [debug-early] fix problem with template parameter packs
On 06/04/2015 07:31 PM, Aldy Hernandez wrote: On 06/04/2015 02:39 PM, Jason Merrill wrote: On 06/04/2015 02:23 PM, Jason Merrill wrote: On 06/03/2015 10:42 AM, Aldy Hernandez wrote: + /* Die was generated early via dwarf2out_early_global_decl. */ + BOOL_BITFIELD dumped_early : 1; Missed a dump. Actually, why do we need this flag? The uses I see are * to avoid declaring prototype parameters multiple times It used to verify the sanity of the late limbo list. I can remove this though if you want. dwarf2out_decl() also has a sanity check to verify that early dumped DIEs are not generated again. I can remove this as well if you prefer. And finally, I believe the big block you speak of below has a check for dumped_early, that may or may not allow it to distinguish for things that happen in LTO which still acts like traditional late dwarf. I haven't checked this though... but if you want it removed I can check and retest. I'm not a huge fan of removing the dumped_early bit because of the sanity checks, but theoretically they shouldn't be necessary when LTO changes are in. LTO will be our test. I've removed them however as you've requested. Can't we just assume that if we have an old DIE, it already has parameters? * to make the logic in gen_variable_die even more horrible It's really not clear to me that we need the new big block of code. I would think that it should be enough to update this: /* If the compiler emitted a definition for the DECL declaration + and we already emitted a DIE for it, don't emit a second DIE for it again. Allow re-declarations of DECLs that are inside functions, though. */ - if (old_die declaration !local_scope_p (context_die)) return; to add locations instead of just returning when !early_dwarf. Incidentally, why did you change declaration to !declaration in this condition? Ah, wait. If we revert that mysterious change, it's clear again that this check is just dealing with avoiding duplicate declarations, so within this condition isn't the right place for adding locations to early DIEs; that should probably happen right after this. This was in Michael Matz's original prototype. I'm surprised it survived this long. So... if I revert the !declaration change and move the big block below said change, would you be OK with it, or did you still want some changes to it? Like the attached patch. How does this look? Aldy gcc/ * dwarf2out.c: Remove deferred_locations*. (dwarf2_debug_hooks): Add early_finish hook. Remove global_decl hook. Add early_global_decl and late_global_decl hook. New global early_dwarf. New structure set_early_dwarf. (output_die): Indicate whether a DIE was generated early when generating assembly with -dA. (struct limbo_die_struct): Document created_for field. Remove file_table_last_lookup. (remove_AT): Return TRUE if successful. (remove_child_TAG): Clear die_parent. (reparent_child): New function abstracted from... (splice_child_die): ...here. (new_die): ICE if a DIE ends up in limbo too late. (print_die): Display (DUMPED EARLY) if appropriate. (check_die): New. (defer_location): Remove. (add_subscript_info): Reuse DW_TAG_subrange_type if available. (fill_variable_array_bounds): New. (decl_start_label): Call fill_variable_array_bounds. (gen_formal_parameter_die): Rewrite to reuse previously generated DIEs. (gen_subprogram_die): Same. (gen_variable_die): Same. (gen_const_die): Same. (gen_label_die): Same. (gen_lexical_block_die): Same. (decl_will_get_specification_p): New. (local_function_static): New. (gen_struct_or_union_type_die): Fill in variable-length fields. (gen_typedef_die): Fill in variable-length typedefs. (gen_tagged_type_die): Gracefully return on error_mark_node. Handle re-entrancy. (gen_type_die_with_usage): Handle variable-length types. Remove duplicate code for ARRAY_TYPE case. (process_scope_var): Only process imported modules during early dwarf. (dwarf2out_early_global_decl): New. (dwarf2out_late_global_decl): Rename from dwarf2out_global_decl. (dwarf2out_type_decl): Set early_dwarf while calling dwarf2out_decl. (dwarf2out_decl): Verify that we did not recreate a previously generated DIE. Do not return on DECL_EXTERNALs in VAR_DECLs. Abstract some code to local_function_static. (lookup_filename): Remove use of file_table_last_lookup. Gracefully exit on missing file_name. (dwarf2out_finish): Verify limbo list. Remove deferred_locations_list use. Move deferred_asm_name and limbo flushing to... (dwarf2out_early_finish): ...here. New. (dwarf2out_c_finalize): Remove set of deferred_location_list, deferred_asm_name, and file_table_last_lookup. * cgraph.h (referred_to_p): Add default argument. * cgraphunit.c (referred_to_p): Add and handle include_self argument. (analyze_functions): Add first_time argument. Call check_global_declaration for all symbols. Call late_global_decl for nodes for moribund nodes.
Re: [debug-early] fix problem with template parameter packs
On 06/04/2015 07:31 PM, Aldy Hernandez wrote: So... if I revert the !declaration change and move the big block below said change, would you be OK with it, or did you still want some changes to it? I'm still hoping to simplify it. Actually, I think we can just remove the if (old_die declaration !local_scope_p (context_die)) check; since inverting its logic didn't seem to break anything before, it can just go. And I'd like to rework the logic in the big block so we don't have three ways of getting to the same thing. Does this work? if (declaration) { /* A declaration that has been previously dumped, needs no further annotations, since it doesn't need location on the second pass. */ return; } else if (origin old_die-die_parent != context_die) { /* If we will be creating an inlined instance, we need a new DIE that will get annotated with DW_AT_abstract_origin. Clear things so we can get a new DIE. */ gcc_assert (!DECL_ABSTRACT_P (decl)); old_die = NULL; } else { /* If a DIE was dumped early, it still needs location info. Skip to where we fill the location bits. */ var_die = old_die; goto gen_variable_die_location; } Jason
Re: [debug-early] fix problem with template parameter packs
Looks good. Jason
Re: [debug-early] fix problem with template parameter packs
On 06/05/2015 12:20 PM, Jason Merrill wrote: Looks good. Jason Attached is the latest against mainline, with the aforementioned change, and without the dumped_early bit. Retested for --enable-languages=all,go,ada, for both GCC and GDB. Let me know how this looks. Aldy gcc/ * dwarf2out.c: Remove deferred_locations*. (dwarf2_debug_hooks): Add early_finish hook. Remove global_decl hook. Add early_global_decl and late_global_decl hook. New global early_dwarf. New structure set_early_dwarf. (output_die): Indicate whether a DIE was generated early when generating assembly with -dA. (struct limbo_die_struct): Document created_for field. Remove file_table_last_lookup. (remove_AT): Return TRUE if successful. (remove_child_TAG): Clear die_parent. (reparent_child): New function abstracted from... (splice_child_die): ...here. (new_die): ICE if a DIE ends up in limbo too late. (print_die): Display (DUMPED EARLY) if appropriate. (check_die): New. (defer_location): Remove. (add_subscript_info): Reuse DW_TAG_subrange_type if available. (fill_variable_array_bounds): New. (decl_start_label): Call fill_variable_array_bounds. (gen_formal_parameter_die): Rewrite to reuse previously generated DIEs. (gen_subprogram_die): Same. (gen_variable_die): Same. (gen_const_die): Same. (gen_label_die): Same. (gen_lexical_block_die): Same. (decl_will_get_specification_p): New. (local_function_static): New. (gen_struct_or_union_type_die): Fill in variable-length fields. (gen_typedef_die): Fill in variable-length typedefs. (gen_tagged_type_die): Gracefully return on error_mark_node. Handle re-entrancy. (gen_type_die_with_usage): Handle variable-length types. Remove duplicate code for ARRAY_TYPE case. (process_scope_var): Only process imported modules during early dwarf. (dwarf2out_early_global_decl): New. (dwarf2out_late_global_decl): Rename from dwarf2out_global_decl. (dwarf2out_type_decl): Set early_dwarf while calling dwarf2out_decl. (dwarf2out_decl): Verify that we did not recreate a previously generated DIE. Do not return on DECL_EXTERNALs in VAR_DECLs. Abstract some code to local_function_static. (lookup_filename): Remove use of file_table_last_lookup. Gracefully exit on missing file_name. (dwarf2out_finish): Verify limbo list. Remove deferred_locations_list use. Move deferred_asm_name and limbo flushing to... (dwarf2out_early_finish): ...here. New. (dwarf2out_c_finalize): Remove set of deferred_location_list, deferred_asm_name, and file_table_last_lookup. * cgraph.h (referred_to_p): Add default argument. * cgraphunit.c (referred_to_p): Add and handle include_self argument. (analyze_functions): Add first_time argument. Call check_global_declaration for all symbols. Call late_global_decl for nodes for moribund nodes. (finalize_compilation_unit): Add new argument to analyze_functions. Call early_global_decl for functions. Call early_finish debug hook. * dbxout.c (dbxout_early_global_decl): New. (dbxout_late_global_decl): New. Adapted from dbxout_global_decl. (dbx_debug_hooks): Add new hooks. (xcoff_debug_hooks): Same. * debug.c (do_nothing_debug_hooks): Add early_finish field. Add early and late debug hooks. Remove global_decl hook. * debug.h (struct gcc_debug_hooks): Add early_finish, early_global_decl, and late_global_decl fields. Remove global_decl field. Document gcc_debug_hooks. * gengtype.c (output_typename): Remove. * godump.c (go_early_global_decl): New. (go_late_global_decl): New. (go_global_decl): Remove. (dump_go_spec_init): Remove global_decl. Add {early,late}_global_decl. * langhooks-def.h (LANG_HOOKS_WRITE_GLOBALS): Remove. (LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): New. * langhooks.c (lhd_warn_unused_global_decl): Adjust comment. (write_global_declarations): Remove. (global_decl_processing): New. * langhooks.h (struct lang_hooks_for_decls): Remove final_write_globals field. Add post_compilation_parsing_cleanups field. * passes.c (rest_of_decl_compilation): Call early_global_decl. * sdbout.c: Add early and late_global_decl hooks. Remove sdbout_global_decl hook. Add early_finish field for sdb_debug_hooks. (sdbout_global_decl): Remove. (sdbout_early_global_decl): New. (sdbout_late_global_decl): New. * timevar.def (TV_PHASE_LATE_PARSING_CLEANUPS): New. * toplev.c (check_global_declaration): Rename from check_global_declaration_1. Adapt to use symtab infrastructure. (check_global_declarations): Remove. (emit_debug_global_declarations): Remove. (compile_file): Remove call to final_write_globals langhook. Run the actual compilation process. Perform any post compilation parser cleanups. Generate late debug info. * toplev.h (check_global_declaration): New. (check_global_declaration_1): Remove. (check_global_declarations): Remove. (write_global_declarations): Remove. (emit_debug_global_declarations): Remove. (global_decl_processing): New. * tree-core.h (struct tree_block): Add DIE field. * tree.h
Re: [debug-early] fix problem with template parameter packs
On 06/05/2015 12:33 PM, Aldy Hernandez wrote: + /* The tree for which this DIE was created for. We use this to Too many fors. - fprintf (outfile, DIE %4ld: %s (%p)\n, + fprintf (outfile, DIE %4ld: %s (%p), die-die_offset, dwarf_tag_name (die-die_tag), (void*) die); + fputc ('\n', outfile); I don't think you need this change. else if (declaration) -gen_formal_types_die (decl, subr_die); +{ + /* Only generate a prototype's parameters once. */ + if (!old_die) + gen_formal_types_die (decl, subr_die); +} I think this is dead code now, since you return early if declaration old_die. OK with those changes. Jason
Re: [debug-early] fix problem with template parameter packs
On 06/05/2015 10:02 AM, Jason Merrill wrote: On 06/04/2015 07:31 PM, Aldy Hernandez wrote: So... if I revert the !declaration change and move the big block below said change, would you be OK with it, or did you still want some changes to it? I'm still hoping to simplify it. Actually, I think we can just remove the if (old_die declaration !local_scope_p (context_die)) check; since inverting its logic didn't seem to break anything before, it can just go. And I'd like to rework the logic in the big block so we don't have three ways of getting to the same thing. Does this work? g++.dg/debug/dwarf2/static-data-member1.C fails because it doesn't get a DW_AT_specification. How about: if (old_die) { if (declaration) { /* A declaration that has been previously dumped, needs no further annotations, since it doesn't need location on the second pass. */ return; } else if (decl_will_get_specification_p (old_die, decl, declaration) !get_AT (old_die, DW_AT_specification)) { /* Fall-thru so we can make a new variable die along with a DW_AT_specification. */ } else if (origin old_die-die_parent != context_die) { /* If we will be creating an inlined instance, we need a new DIE that will get annotated with DW_AT_abstract_origin. Clear things so we can get a new DIE. */ gcc_assert (!DECL_ABSTRACT_P (decl)); old_die = NULL; } else { /* If a DIE was dumped early, it still needs location info. Skip to where we fill the location bits. */ var_die = old_die; goto gen_variable_die_location; } }
Re: [debug-early] fix problem with template parameter packs
On 06/04/2015 05:34 PM, Jason Merrill wrote: On 06/03/2015 10:42 AM, Aldy Hernandez wrote: - if (decl (DECL_ABSTRACT_P (decl) || declaration || old_die == NULL)) + if (decl (DECL_ABSTRACT_P (decl) + || !old_die || is_declaration_die (old_die))) Do we still need DECL_ABSTRACT_P? I wouldn't expect to get here when emitting the abstract function, as we should already have a die from early dwarf. Remember that LTO still behaves as mainline currently does, so there will be no early dwarf. Once Richi's LTO streaming is in, all this DECL_ABSTRACT stuff should go. Aldy
Re: [debug-early] fix problem with template parameter packs
On 06/04/2015 02:39 PM, Jason Merrill wrote: On 06/04/2015 02:23 PM, Jason Merrill wrote: On 06/03/2015 10:42 AM, Aldy Hernandez wrote: + /* Die was generated early via dwarf2out_early_global_decl. */ + BOOL_BITFIELD dumped_early : 1; Missed a dump. Actually, why do we need this flag? The uses I see are * to avoid declaring prototype parameters multiple times It used to verify the sanity of the late limbo list. I can remove this though if you want. dwarf2out_decl() also has a sanity check to verify that early dumped DIEs are not generated again. I can remove this as well if you prefer. And finally, I believe the big block you speak of below has a check for dumped_early, that may or may not allow it to distinguish for things that happen in LTO which still acts like traditional late dwarf. I haven't checked this though... but if you want it removed I can check and retest. Can't we just assume that if we have an old DIE, it already has parameters? * to make the logic in gen_variable_die even more horrible It's really not clear to me that we need the new big block of code. I would think that it should be enough to update this: /* If the compiler emitted a definition for the DECL declaration + and we already emitted a DIE for it, don't emit a second DIE for it again. Allow re-declarations of DECLs that are inside functions, though. */ - if (old_die declaration !local_scope_p (context_die)) return; to add locations instead of just returning when !early_dwarf. Incidentally, why did you change declaration to !declaration in this condition? Ah, wait. If we revert that mysterious change, it's clear again that this check is just dealing with avoiding duplicate declarations, so within this condition isn't the right place for adding locations to early DIEs; that should probably happen right after this. This was in Michael Matz's original prototype. I'm surprised it survived this long. So... if I revert the !declaration change and move the big block below said change, would you be OK with it, or did you still want some changes to it? Aldy
Re: [debug-early] fix problem with template parameter packs
On 06/03/2015 10:42 AM, Aldy Hernandez wrote: - if (decl (DECL_ABSTRACT_P (decl) || declaration || old_die == NULL)) + if (decl (DECL_ABSTRACT_P (decl) + || !old_die || is_declaration_die (old_die))) Do we still need DECL_ABSTRACT_P? I wouldn't expect to get here when emitting the abstract function, as we should already have a die from early dwarf. Jason
Re: [debug-early] fix problem with template parameter packs
On 06/03/2015 10:42 AM, Aldy Hernandez wrote: + /* Die was generated early via dwarf2out_early_global_decl. */ + BOOL_BITFIELD dumped_early : 1; Missed a dump. Actually, why do we need this flag? The uses I see are * to avoid declaring prototype parameters multiple times Can't we just assume that if we have an old DIE, it already has parameters? * to make the logic in gen_variable_die even more horrible It's really not clear to me that we need the new big block of code. I would think that it should be enough to update this: /* If the compiler emitted a definition for the DECL declaration + and we already emitted a DIE for it, don't emit a second DIE for it again. Allow re-declarations of DECLs that are inside functions, though. */ - if (old_die declaration !local_scope_p (context_die)) return; to add locations instead of just returning when !early_dwarf. Incidentally, why did you change declaration to !declaration in this condition? Jason
Re: [debug-early] fix problem with template parameter packs
On 06/04/2015 02:23 PM, Jason Merrill wrote: On 06/03/2015 10:42 AM, Aldy Hernandez wrote: + /* Die was generated early via dwarf2out_early_global_decl. */ + BOOL_BITFIELD dumped_early : 1; Missed a dump. Actually, why do we need this flag? The uses I see are * to avoid declaring prototype parameters multiple times Can't we just assume that if we have an old DIE, it already has parameters? * to make the logic in gen_variable_die even more horrible It's really not clear to me that we need the new big block of code. I would think that it should be enough to update this: /* If the compiler emitted a definition for the DECL declaration + and we already emitted a DIE for it, don't emit a second DIE for it again. Allow re-declarations of DECLs that are inside functions, though. */ - if (old_die declaration !local_scope_p (context_die)) return; to add locations instead of just returning when !early_dwarf. Incidentally, why did you change declaration to !declaration in this condition? Ah, wait. If we revert that mysterious change, it's clear again that this check is just dealing with avoiding duplicate declarations, so within this condition isn't the right place for adding locations to early DIEs; that should probably happen right after this. Jason
Re: [debug-early] fix problem with template parameter packs
On 06/03/2015 09:06 AM, Richard Biener wrote: On Wed, Jun 3, 2015 at 3:04 PM, Aldy Hernandez al...@redhat.com wrote: On 05/27/2015 03:34 PM, Jason Merrill wrote: It occurs to me that the early-dwarf work should make debug_abstract_function and most of the DECL_ABSTRACT handling obsolete. All we need to do is set DW_AT_inline during early debug and update it during late debug if the function is inlined. This is certainly a cool idea. I played around with this, and I think we should be able to get it to work. However, this won't work for the LTO case, because dwarf2out currently works just as our pre-debug-early world did. We don't have an early DIE we can annotate later. At least, until we get Richi's DIE streaming idea working. We could temporarily make the LTO case behave like early-debug by emitting early DIEs after LTO stream in-- while we get DIE streaming implemented, or we could leave the DECL_ABSTRACT redesign post-richi-streaming. I'm leaning towards the latter. Yeah, I think we can delay this until I get the LTO bits working and merged (well, I mostly have to sit down and re-do the tooling :/) Richard. In that case, I have updated dwarf2out_abstract_function to include a comment explaining its imminent demise, and have updated the comment regarding the template parameter packs. Jason, here is the last revision for everything except the front-ends. I believe the only bits not yet approved here are the dwarf2out.c changes. Let me know if you need anything else. Tested on x86-64 Linux. Thanks. gcc/ * dwarf2out.c: Remove deferred_locations*. (dwarf2_debug_hooks): Add early_finish hook. Remove global_decl hook. Add early_global_decl and late_global_decl hook. Add dumped_early bit to die_struct. New global early_dwarf. New structure set_early_dwarf. (output_die): Indicate whether a DIE was generated early when generating assembly with -dA. (struct limbo_die_struct): Document created_for field. Remove file_table_last_lookup. (remove_AT): Return TRUE if successful. (remove_child_TAG): Clear die_parent. (reparent_child): New function abstracted from... (splice_child_die): ...here. (new_die): Set dumped_early field if appropriate. ICE if a DIE ends up in limbo too late. (print_die): Display (DUMPED EARLY) if appropriate. (check_die): New. (defer_location): Remove. (add_subscript_info): Reuse DW_TAG_subrange_type if available. (fill_variable_array_bounds): New. (decl_start_label): Call fill_variable_array_bounds. (gen_formal_parameter_die): Rewrite to reuse previously generated DIEs. (gen_subprogram_die): Same. (gen_variable_die): Same. (gen_const_die): Same. (gen_label_die): Same. (gen_lexical_block_die): Same. (decl_will_get_specification_p): New. (local_function_static): New. (gen_struct_or_union_type_die): Fill in variable-length fields. (gen_typedef_die): Fill in variable-length typedefs. (gen_tagged_type_die): Gracefully return on error_mark_node. Handle re-entrancy. (gen_type_die_with_usage): Handle variable-length types. Remove duplicate code for ARRAY_TYPE case. (process_scope_var): Only process imported modules during early dwarf. (dwarf2out_early_global_decl): New. (dwarf2out_late_global_decl): Rename from dwarf2out_global_decl. (dwarf2out_type_decl): Set early_dwarf while calling dwarf2out_decl. (dwarf2out_decl): Verify that we did not recreate a previously generated DIE. Do not return on DECL_EXTERNALs in VAR_DECLs. Abstract some code to local_function_static. (lookup_filename): Remove use of file_table_last_lookup. Gracefully exit on missing file_name. (dwarf2out_finish): Verify limbo list. Remove deferred_locations_list use. Move deferred_asm_name and limbo flushing to... (dwarf2out_early_finish): ...here. New. (dwarf2out_c_finalize): Remove set of deferred_location_list, deferred_asm_name, and file_table_last_lookup. * cgraph.h (referred_to_p): Add default argument. * cgraphunit.c (referred_to_p): Add and handle include_self argument. (analyze_functions): Add first_time argument. Call check_global_declaration for all symbols. Call late_global_decl for nodes for moribund nodes. (finalize_compilation_unit): Add new argument to analyze_functions. Call early_global_decl for functions. Call early_finish debug hook. * dbxout.c (dbxout_early_global_decl): New. (dbxout_late_global_decl): New. Adapted from dbxout_global_decl. (dbx_debug_hooks): Add new hooks. (xcoff_debug_hooks): Same. * debug.c (do_nothing_debug_hooks): Add early_finish field. Add early and late debug hooks. Remove global_decl hook. * debug.h (struct gcc_debug_hooks): Add early_finish, early_global_decl, and late_global_decl fields. Remove global_decl field. Document gcc_debug_hooks. * gengtype.c (output_typename): Remove. * godump.c (go_early_global_decl): New. (go_late_global_decl): New. (go_global_decl): Remove. (dump_go_spec_init): Remove global_decl. Add {early,late}_global_decl. * langhooks-def.h
Re: [debug-early] fix problem with template parameter packs
On 05/27/2015 03:34 PM, Jason Merrill wrote: It occurs to me that the early-dwarf work should make debug_abstract_function and most of the DECL_ABSTRACT handling obsolete. All we need to do is set DW_AT_inline during early debug and update it during late debug if the function is inlined. This is certainly a cool idea. I played around with this, and I think we should be able to get it to work. However, this won't work for the LTO case, because dwarf2out currently works just as our pre-debug-early world did. We don't have an early DIE we can annotate later. At least, until we get Richi's DIE streaming idea working. We could temporarily make the LTO case behave like early-debug by emitting early DIEs after LTO stream in-- while we get DIE streaming implemented, or we could leave the DECL_ABSTRACT redesign post-richi-streaming. I'm leaning towards the latter. Thoughts?
Re: [debug-early] fix problem with template parameter packs
On Wed, Jun 3, 2015 at 3:04 PM, Aldy Hernandez al...@redhat.com wrote: On 05/27/2015 03:34 PM, Jason Merrill wrote: It occurs to me that the early-dwarf work should make debug_abstract_function and most of the DECL_ABSTRACT handling obsolete. All we need to do is set DW_AT_inline during early debug and update it during late debug if the function is inlined. This is certainly a cool idea. I played around with this, and I think we should be able to get it to work. However, this won't work for the LTO case, because dwarf2out currently works just as our pre-debug-early world did. We don't have an early DIE we can annotate later. At least, until we get Richi's DIE streaming idea working. We could temporarily make the LTO case behave like early-debug by emitting early DIEs after LTO stream in-- while we get DIE streaming implemented, or we could leave the DECL_ABSTRACT redesign post-richi-streaming. I'm leaning towards the latter. Yeah, I think we can delay this until I get the LTO bits working and merged (well, I mostly have to sit down and re-do the tooling :/) Richard. Thoughts?
Re: [debug-early] fix problem with template parameter packs
On Wed, May 27, 2015 at 9:34 PM, Jason Merrill ja...@redhat.com wrote: OK, I see the issue. We're calling debug_abstract_function to build debug info for the abstract instance of a function that we already built from dwarf2out_early_global_decl. It occurs to me that the early-dwarf work should make debug_abstract_function and most of the DECL_ABSTRACT handling obsolete. All we need to do is set DW_AT_inline during early debug and update it during late debug if the function is inlined. Yes, that was my idea as well. The early dwarf _is_ the abstract variant after all (until we annotate it further without going through another indirection like I did for LTO). Richard. Jason
Re: [debug-early] fix problem with template parameter packs
OK, I see the issue. We're calling debug_abstract_function to build debug info for the abstract instance of a function that we already built from dwarf2out_early_global_decl. It occurs to me that the early-dwarf work should make debug_abstract_function and most of the DECL_ABSTRACT handling obsolete. All we need to do is set DW_AT_inline during early debug and update it during late debug if the function is inlined. Jason
Re: [debug-early] fix problem with template parameter packs
On 05/06/2015 12:28 PM, Jason Merrill wrote: On 05/05/2015 04:33 PM, Aldy Hernandez wrote: On 05/05/2015 02:08 PM, Jason Merrill wrote: On 05/04/2015 09:29 PM, Aldy Hernandez wrote: The code handling parameter DIEs needed a little tweaking for variable length template arguments. I've relaxed the original assert, but this may require tweaking at branch review time-- hopefully later this week. What testcase motivated this? We're within a formal_parameter_pack, but Pretty much every other test in the libstdc++-v3 testsuite was failing with the ICE I elided in my patch. I wasn't able to narrow it down to a tiny test, but I can do so if you want. ?? I think that would be helpful so we can decide what we want the debug output to look like. Jason Removing the aforementioned patch from the branch with the attached one-liner, you can reproduce on the following reduced testcase (-O -g -quiet -std=gnu++14): template typename _Tp _Tp forward () { }; template typename blahblah class vector { public: template typename ... _Args void emplace_back (_Args ...); template typename ... _Args void _M_emplace_back_aux (_Args ...); }; template typename _Tp template typename ... _Args void vector _Tp ::emplace_back (_Args ...) { _M_emplace_back_aux (forward _Args ...); } void foobar () { vector int myvecint; myvecint.emplace_back (0, 0); } diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 7502fbc..4f3b484 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -18006,6 +18006,7 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, } else { + gcc_unreachable(); /* Reuse DIE even with a differing context. This happens when called through
Re: [debug-early] fix problem with template parameter packs
On 05/05/2015 04:33 PM, Aldy Hernandez wrote: On 05/05/2015 02:08 PM, Jason Merrill wrote: On 05/04/2015 09:29 PM, Aldy Hernandez wrote: The code handling parameter DIEs needed a little tweaking for variable length template arguments. I've relaxed the original assert, but this may require tweaking at branch review time-- hopefully later this week. What testcase motivated this? We're within a formal_parameter_pack, but Pretty much every other test in the libstdc++-v3 testsuite was failing with the ICE I elided in my patch. I wasn't able to narrow it down to a tiny test, but I can do so if you want. ?? I think that would be helpful so we can decide what we want the debug output to look like. Jason
Re: [debug-early] fix problem with template parameter packs
On 05/04/2015 09:29 PM, Aldy Hernandez wrote: The code handling parameter DIEs needed a little tweaking for variable length template arguments. I've relaxed the original assert, but this may require tweaking at branch review time-- hopefully later this week. What testcase motivated this? We're within a formal_parameter_pack, but DECL_ABSTRACT is set, so I guess the earlier parm_die was from a declaration? If we're going to re-use the individual parms, I'd think we want to reuse the pack as well. Jason
Re: [debug-early] fix problem with template parameter packs
On 05/05/2015 02:08 PM, Jason Merrill wrote: On 05/04/2015 09:29 PM, Aldy Hernandez wrote: The code handling parameter DIEs needed a little tweaking for variable length template arguments. I've relaxed the original assert, but this may require tweaking at branch review time-- hopefully later this week. What testcase motivated this? We're within a formal_parameter_pack, but Pretty much every other test in the libstdc++-v3 testsuite was failing with the ICE I elided in my patch. I wasn't able to narrow it down to a tiny test, but I can do so if you want. ?? Aldy