diff mbox

[debug-early] fix problem with template parameter packs

Message ID 5564A158.8010604@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez May 26, 2015, 4:37 p.m. UTC
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);
}

Comments

Jason Merrill May 27, 2015, 7:34 p.m. UTC | #1
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
Aldy Hernandez June 3, 2015, 1:04 p.m. UTC | #2
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?
Richard Biener June 3, 2015, 1:06 p.m. UTC | #3
On Wed, Jun 3, 2015 at 3:04 PM, Aldy Hernandez <aldyh@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?
>
diff mbox

Patch

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