Bug 16261 - [3.4 regression] ICE: output_die, at dwarf2out.c:6628
Summary: [3.4 regression] ICE: output_die, at dwarf2out.c:6628
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 3.4.0
: P2 critical
Target Milestone: 3.4.4
Assignee: Eric Botcazou
URL:
Keywords: ice-on-valid-code, monitored, patch
: 18280 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-06-29 10:51 UTC by akim@lrde.epita.fr
Modified: 2005-01-18 21:41 UTC (History)
4 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work: 3.3.4 4.0.0
Known to fail: 3.4.0 3.4.1
Last reconfirmed: 2004-06-29 11:11:02


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description akim@lrde.epita.fr 2004-06-29 10:51:31 UTC

G++ 3.4 enjoys an ICE when compiling the following code with -g:

namespace temp
{
  template <class Ident_>
  struct Map
  {
  };

  typedef Map <int> TempMap;

}

extern temp::TempMap tempmap;

void
instructions_display (void)
{
  struct NolimipsTempMap
    : public temp::TempMap
  {
    NolimipsTempMap (const temp::TempMap &tm)
      : temp::TempMap (tm)
    {
    }
  };

  NolimipsTempMap tm (tempmap);
}

No other version of GCC I use faces this problem (3.3, or 3.5).

Environment:
System: Linux tchernobyl 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002 i686 GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home/lrde/stud/burrus_n/work/lrde/ext/gcc/configure --prefix=/home/lrde/lrde/usr/gcc-3.4 --enable-languages=c,c++

How-To-Repeat:
% g++-3.4 -c tasks.cc
% g++-3.4 -c -g tasks.cc
tasks.cc:27: internal compiler error: in output_die, at dwarf2out.c:6628
SVP soumettre un rapport complet d'anomalies,
avec le source pré-traité si cela est approprié.
Consulter <URL:http://gcc.gnu.org/bugs.html> pour les instructions.
Comment 1 akim@lrde.epita.fr 2004-06-29 10:51:31 UTC
Fix:
Note that the namespace is needed.
Comment 2 Volker Reichelt 2004-06-29 11:11:01 UTC
Confirmed.

You don't even need inheritance to crash the compiler:

===========================================
namespace N
{
    template<int> struct A {};
    typedef A<0> B;
}

void foo()
{
    struct C
    {
        C(const N::B&) {}
    };

    N::B b;
    C c(b);
}
===========================================
Comment 3 Volker Reichelt 2004-06-29 14:13:06 UTC
Btw, the bug was fixed on mainline by Devang's patch
http://gcc.gnu.org/ml/gcc-cvs/2004-01/msg01394.html

Is a backport to the 3.4 branch feasible?
Comment 4 Andrew Pinski 2004-06-29 14:25:05 UTC
Note his patch adds a feature and a huge amount of extra debuging info.
Comment 5 akim 2004-06-29 15:47:06 UTC
Subject: Re:  New: ICE: output_die, at dwarf2out.c:6628


It is not related to the bug per se, but I'm unsure where I should
report this:

  |From: Bugzilla Mail Interface <bugmail@gcc.gnu.org>
  |Subject: Bugzilla success (ID 16261)
  |To: akim@lrde.epita.fr
  |Date: 29 Jun 2004 10:51:36 -0000
  |X-Sent: 4 hours, 53 minutes, 28 seconds ago
  |
  |  
  |  +----------------------------------------------------+
  |            GCC Bug reporting interface. 
  |  +----------------------------------------------------+
  |
  |  Your GCC Bug Reporting interface request was successfull.

s/ successfull / successful /.
Comment 6 Volker Reichelt 2004-07-02 23:58:44 UTC
The typo in bugzilla's mail interface has been fixed.
Comment 7 Mark Mitchell 2004-08-17 23:59:36 UTC
Devang's patch is too invasive to backport.

Is there any way that we can avoid the ICE without making such an extensive change?
Comment 8 Mark Mitchell 2004-08-29 18:11:50 UTC
Postponed until GCC 3.4.3.
Comment 9 Mark Mitchell 2004-08-29 18:14:41 UTC
Postponed until GCC 3.4.3.
Comment 10 Mark Mitchell 2004-11-01 00:45:21 UTC
Postponed until GCC 3.4.4.
Comment 11 Volker Reichelt 2004-11-08 21:47:57 UTC
*** Bug 18280 has been marked as a duplicate of this bug. ***
Comment 12 Volker Reichelt 2004-11-08 21:49:04 UTC
Here's a testcase without templates:

====================
namespace N
{
    struct A {};
    typedef A B;
}

void foo()
{
    struct C
    {
        C(N::B) {}
    };

    N::B b;
    C c(b);
}
====================
Comment 13 Eric Botcazou 2004-12-02 14:31:29 UTC
Testing a fix.
Comment 14 Eric Botcazou 2004-12-02 14:32:53 UTC
Recategorizing.
Comment 15 Andrew Pinski 2004-12-05 23:07:03 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00362.html>.
Comment 16 CVS Commits 2005-01-05 10:01:48 UTC
Subject: Bug 16261

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-rhl-branch
Changes by:	jakub@gcc.gnu.org	2005-01-05 10:01:27

Modified files:
	gcc            : ChangeLog dwarf2out.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/debug: typedef2.C 

Log message:
	2004-12-05  Eric Botcazou  <ebotcazou@libertysurf.fr>
	
	PR debug/16261
	Backport from mainline:
	2004-01-27  Devang Patel  <dpatel@apple.com>
	
	* dwarf2out.c: (remove_child_TAG): New function.
	(gen_subprogram_die): Do not remove all children dies while reusing
	declaration die for definition.  Instead, selectively remove only formal
	parameters.
	
	2004-12-05  Eric Botcazou  <ebotcazou@libertysurf.fr>
	
	* g++.dg/debug/typedef2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=2.2326.2.399.2.68&r2=2.2326.2.399.2.69
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.478.2.8.2.5&r2=1.478.2.8.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=1.3389.2.170.2.38&r2=1.3389.2.170.2.39
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/debug/typedef2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-rhl-branch&r1=NONE&r2=1.1.18.1

Comment 17 CVS Commits 2005-01-18 21:39:59 UTC
Subject: Bug 16261

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	ebotcazou@gcc.gnu.org	2005-01-18 21:39:39

Modified files:
	gcc            : ChangeLog dwarf2out.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/debug: typedef3.C 

Log message:
	PR debug/16261
	Backport from mainline:
	2004-01-27  Devang Patel  <dpatel@apple.com>
	
	* dwarf2out.c: (remove_child_TAG): New function.
	(gen_subprogram_die): Do not remove all children dies while reusing
	declaration die for definition.  Instead, selectively remove only
	formal parameters.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.776&r2=2.2326.2.777
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.478.2.14&r2=1.478.2.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.345&r2=1.3389.2.346
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/debug/typedef3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 18 Eric Botcazou 2005-01-18 21:41:41 UTC
Patch applied.