Bug 41570 - [4.5 Regression] [c++0x] ICE with -g and variadic templates
Summary: [4.5 Regression] [c++0x] ICE with -g and variadic templates
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Dodji Seketeli
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-04 17:44 UTC by Ciaran McCreesh
Modified: 2009-10-12 12:16 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-10-08 17:54:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ciaran McCreesh 2009-10-04 17:44:37 UTC
g++ (Gentoo SVN) 4.5.0-pre9999 built 20091004 (experimental) rev. 152437

$ g++ -c -std=gnu++0x a.cc && echo ok
ok

$ g++ -c -std=gnu++0x a.cc -g && echo ok
a.cc: In instantiation of ‘M<C>’:
a.cc:22:44:   instantiated from ‘M<B, C>’
a.cc:22:44:   instantiated from ‘M<A, B, C>’
a.cc:37:20:   instantiated from here
a.cc:21:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.gentoo.org/> for instructions.

$ cat a.cc
template <typename...>
struct M;

template <typename I_, typename T_>
struct E
{
};

struct T
{
};

template <>
struct M<>
{
    typedef T Type;
};

template <typename H_, typename... T_>
struct M<H_, T_...>
{
    typedef E<H_, typename M<T_...>::Type> Type;
};

struct A
{
};

struct R :
    M<A>::Type
{
};
Comment 1 Ciaran McCreesh 2009-10-04 22:55:44 UTC
This was introduced in svn://gcc.gnu.org/svn/gcc/trunk@152043 for bug 41266. The DECL_NAME (parm_pack) assertion doesn't hold if the pack's empty.

This leads to a much simpler test case:

template <typename...>
struct M
{
};

struct R :
    M<>
{
};
Comment 2 Dodji Seketeli 2009-10-11 21:51:43 UTC
Patch sent to http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00720.html .
Comment 3 Dodji Seketeli 2009-10-12 11:57:44 UTC
Subject: Bug 41570

Author: dodji
Date: Mon Oct 12 11:57:30 2009
New Revision: 152663

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152663
Log:
Candidate fix for PR c++/41570

gcc/ChangeLog:
	PR c++/41570
	* gcc/dwarf2out.c (template_parameter_pack_die,
	gen_formal_parameter_pack_die): Use add_name_and_src_coords_attributes.

gcc/testsuite/ChangeLog:
	PR c++/41570
	* gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Dodji Seketeli 2009-10-12 12:16:54 UTC
Fixed in 4.5.
Comment 5 hjl@gcc.gnu.org 2009-10-15 21:18:16 UTC
Subject: Bug 41570

Author: hjl
Date: Thu Oct 15 21:17:36 2009
New Revision: 152870

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152870
Log:
2009-10-15  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2009-10-13  Martin Jambor  <mjambor@suse.cz>

	* gcc.c-torture/compile/pr41661.c: New test.

	2009-10-12  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/41683
	* gfortran.dg/fmt_error_9.f: Add check for repeat count after P.

	2009-10-12  Dodji Seketeli  <dodji@redhat.com>

	PR c++/41570
	* g++.dg/debug/dwarf2/template-params-7.C: New test.

	2009-10-11  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/41555
	* gcc.dg/torture/pr41555.c: New testcase.

	2009-10-09  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/41634
	* gcc.c-torture/compile/pr41634.c: New testcase.

	2009-10-08  Michael Matz  <matz@suse.de>

	PR middle-end/41573
	* gcc.dg/pr41573.c: New test.

	2009-10-07  Joseph Myers  <joseph@codesourcery.com>

	PR c/41182
	* gcc.c-torture/compile/pr41182-1.c: New.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C
      - copied unchanged from r152869, trunk/gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c
      - copied unchanged from r152869, trunk/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr41634.c
      - copied unchanged from r152869, trunk/gcc/testsuite/gcc.c-torture/compile/pr41634.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr41661.c
      - copied unchanged from r152868, trunk/gcc/testsuite/gcc.c-torture/compile/pr41661.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41573.c
      - copied unchanged from r152869, trunk/gcc/testsuite/gcc.dg/pr41573.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr41555.c
      - copied unchanged from r152869, trunk/gcc/testsuite/gcc.dg/torture/pr41555.c
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/fmt_error_9.f
      - copied unchanged from r152869, trunk/gcc/testsuite/gfortran.dg/fmt_error_9.f
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog