diff mbox

[debug-early] fix problem with template parameter packs

Message ID 55482AF6.1090207@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez May 5, 2015, 2:29 a.m. UTC
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.

Committing to branch.

Aldy

p.s. Richi/Jason: Winter is coming.  Down to 1 GCC regression which is 
actually a missed DIE optimization which I hope I can fix post merge.

Comments

Jason Merrill May 5, 2015, 9:08 p.m. UTC | #1
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
Aldy Hernandez May 5, 2015, 9:33 p.m. UTC | #2
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
Jason Merrill May 6, 2015, 4:28 p.m. UTC | #3
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
diff mbox

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index c51cea1..a5b155f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -18018,8 +18018,20 @@  gen_formal_parameter_die (tree node, tree origin, bool emit_name_p,
 	 DW_AT_abstract_origin.  */
       if (parm_die && parm_die->die_parent != context_die)
 	{
-	  gcc_assert (!DECL_ABSTRACT_P (node));
-	  parm_die = NULL;
+	  if (!DECL_ABSTRACT_P (node))
+	    {
+	      gcc_assert (!DECL_ABSTRACT_P (node));
+	      parm_die = NULL;
+	    }
+	  else
+	    {
+	      /* Reuse DIE even with a differing context.  This
+		 happens when called through
+		 dwarf2out_abstract_function for
+		 formal parameter packs.  */
+	      gcc_assert (parm_die->die_parent->die_tag
+			  == DW_TAG_GNU_formal_parameter_pack);
+	    }
 	}
 
       if (parm_die && parm_die->die_parent == NULL)