public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17695] New: ICE when compiling with -g
@ 2004-09-27 16:28 fsm at robots dot ox dot ac dot uk
  2004-09-27 16:50 ` [Bug c++/17695] [4.0 regression] ICE in add_abstract_origin_attribute bangerth at dealii dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: fsm at robots dot ox dot ac dot uk @ 2004-09-27 16:28 UTC (permalink / raw)
  To: gcc-bugs

A simple piece of code (distilled below) gives ICE with -g but not without.
The behaviour has persisted over a week or so of CVS checkouts.


[Could an explanation of "host triplet", "target triplet" and "build triplet"
 be provided somewhere? I had to guess/google to find out what you wanted and
 I am still not sure it is right.]


$ uname -a
Linux theseus 2.4.20-8smp #1 SMP Thu Mar 13 17:45:54 EST 2003 i686 i686 i386
GNU/Linux


$ gcc -v
Reading specs from /lvm/fred/gcc/cvs/install/lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Configured with: ../gcc/configure --prefix=/lvm/fred/gcc/cvs/install
--enable-static --enable-shared --enable-languages=c,c++,f95
--with-mpfr=/lvm/fred/pkg/gmp/install
Thread model: posix
gcc version 4.0.0 20040927 (experimental)


--------------8<-------------
// gives ICE when compiled with -g
template <typename T>
struct A
{
  A(T *);
};
                                                                               
                                                                               
                                                   template <typename T>
struct B : A<T>
{
  B();
};
                                                                               
                                                                               
                                                   struct C
{
  C();
};
                                                                               
                                                                               
                                                   C::C()
{
  typedef double D;
  B<D> foo;
}

-- 
           Summary: ICE when compiling with -g
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fsm at robots dot ox dot ac dot uk
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17695


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/17695] [4.0 regression] ICE in add_abstract_origin_attribute
  2004-09-27 16:28 [Bug c++/17695] New: ICE when compiling with -g fsm at robots dot ox dot ac dot uk
@ 2004-09-27 16:50 ` bangerth at dealii dot org
  2004-09-27 17:03 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2004-09-27 16:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-09-27 16:50 -------
Confirmed, a marginally shorter version is this: 
---------------------- 
template <typename T> struct A { 
    T *p; 
}; 
 
template <typename T> struct B : A<T> { 
    B(); 
}; 
                                                                                
struct C { 
    C() { 
      typedef double D; 
      B<D> foo; 
    } 
} c; 
---------------------------- 
g/x> /home/bangerth/bin/gcc-4.0-pre/bin/c++ -g -c x.cc  
x.cc: In constructor `C::C()': 
x.cc:13: internal compiler error: in add_abstract_origin_attribute, at 
dwarf2out.c:10411 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
This is a regression over all previous versions. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |4.0.0
      Known to work|                            |3.2.3 3.4.0 3.3.4
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-27 16:50:23
               date|                            |
            Summary|ICE when compiling with -g  |[4.0 regression] ICE in
                   |                            |add_abstract_origin_attribut
                   |                            |e
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17695


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/17695] [4.0 regression] ICE in add_abstract_origin_attribute
  2004-09-27 16:28 [Bug c++/17695] New: ICE when compiling with -g fsm at robots dot ox dot ac dot uk
  2004-09-27 16:50 ` [Bug c++/17695] [4.0 regression] ICE in add_abstract_origin_attribute bangerth at dealii dot org
@ 2004-09-27 17:03 ` pinskia at gcc dot gnu dot org
  2004-09-27 18:27 ` reichelt at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-27 17:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-27 17:03 -------
: Search converges between 2004-05-11-trunk (#454) and 2004-05-14-trunk (#455).

Double hmm.
This has been failing since 2003-05-30 on the tree-ssa branch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17695


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/17695] [4.0 regression] ICE in add_abstract_origin_attribute
  2004-09-27 16:28 [Bug c++/17695] New: ICE when compiling with -g fsm at robots dot ox dot ac dot uk
  2004-09-27 16:50 ` [Bug c++/17695] [4.0 regression] ICE in add_abstract_origin_attribute bangerth at dealii dot org
  2004-09-27 17:03 ` pinskia at gcc dot gnu dot org
@ 2004-09-27 18:27 ` reichelt at gcc dot gnu dot org
  2004-10-29  1:42 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-09-27 18:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-09-27 18:27 -------
Here's something without inheritance:

==========================================
template<typename T> struct A
{
    T t;
    A();
};

struct B
{
    B() { typedef int C; A<C> a; }
} b;
==========================================


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
           Keywords|                            |monitored


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17695


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/17695] [4.0 regression] ICE in add_abstract_origin_attribute
  2004-09-27 16:28 [Bug c++/17695] New: ICE when compiling with -g fsm at robots dot ox dot ac dot uk
                   ` (2 preceding siblings ...)
  2004-09-27 18:27 ` reichelt at gcc dot gnu dot org
@ 2004-10-29  1:42 ` mmitchel at gcc dot gnu dot org
  2004-10-29  2:05 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-10-29  1:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-10-29 01:42 -------
The problem here is an ordering issue.

When we see A<C>, we instantiate it, and call gen_type_die for A<C>.  That
causes us to generate DIEs for all members of A<C>, including A<C>::t.  The type
of A<C>::t is C, so we now go to generate a DIE for C.  C is not presently
marked as DECL_ABSTRACT, so we do not enter it in the decl->DIE table.  Later,
we realize that B::B() is an abstract instance, so we go ahead and mark C as
DECL_ABSTRACT -- but it's too late, we've already dealt with its DIE.  Then, we
process one of the clones of B::B(), encounter a copy of the typedef, go back to
the abstract origin of the typedef, and try to look it up -- but it's not in the
table.

In GCC 3.4, this worked because we did not actually copy the typedef into the
clone.  Therefore, there was never a second typedef pointing back at the
original typedef.  However, remap_decl has been changed to make a copy of all
declarations, even static variables and typedefs. So, now we have a problem.

I'm working on a fix.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17695


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/17695] [4.0 regression] ICE in add_abstract_origin_attribute
  2004-09-27 16:28 [Bug c++/17695] New: ICE when compiling with -g fsm at robots dot ox dot ac dot uk
                   ` (3 preceding siblings ...)
  2004-10-29  1:42 ` mmitchel at gcc dot gnu dot org
@ 2004-10-29  2:05 ` mmitchel at gcc dot gnu dot org
  2004-10-29  7:17 ` cvs-commit at gcc dot gnu dot org
  2004-10-29  7:27 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-10-29  2:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-10-29 02:05 -------
My attempted fix failed.

Things will not be easy, given that we're copying the typedef.  Because we call
rest_of_type_compilation for A<C> even before the end of the B::B() function, we
must somehow arrange to create the C typedef with DECL_ABSTRACT set; we do not
have an opportunity to go back and set DECL_ABSTRACT later.

Trying an ugly hack...

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17695


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/17695] [4.0 regression] ICE in add_abstract_origin_attribute
  2004-09-27 16:28 [Bug c++/17695] New: ICE when compiling with -g fsm at robots dot ox dot ac dot uk
                   ` (4 preceding siblings ...)
  2004-10-29  2:05 ` mmitchel at gcc dot gnu dot org
@ 2004-10-29  7:17 ` cvs-commit at gcc dot gnu dot org
  2004-10-29  7:27 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-29  7:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-29 07:17 -------
Subject: Bug 17695

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-10-29 07:16:50

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

Log message:
	PR c++/17695
	* decl.c (grokdeclarator): Mark TYPE_DECLs as abstract when they
	appear in a constructor/destructor that will be cloned.
	
	PR c++/17695
	* g++.dg/debug/typedef2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4462&r2=1.4463
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1321&r2=1.1322
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4517&r2=1.4518
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/debug/typedef2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17695


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/17695] [4.0 regression] ICE in add_abstract_origin_attribute
  2004-09-27 16:28 [Bug c++/17695] New: ICE when compiling with -g fsm at robots dot ox dot ac dot uk
                   ` (5 preceding siblings ...)
  2004-10-29  7:17 ` cvs-commit at gcc dot gnu dot org
@ 2004-10-29  7:27 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-10-29  7:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-10-29 07:27 -------
Fixed in GCC 4.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17695


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-10-29  7:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-27 16:28 [Bug c++/17695] New: ICE when compiling with -g fsm at robots dot ox dot ac dot uk
2004-09-27 16:50 ` [Bug c++/17695] [4.0 regression] ICE in add_abstract_origin_attribute bangerth at dealii dot org
2004-09-27 17:03 ` pinskia at gcc dot gnu dot org
2004-09-27 18:27 ` reichelt at gcc dot gnu dot org
2004-10-29  1:42 ` mmitchel at gcc dot gnu dot org
2004-10-29  2:05 ` mmitchel at gcc dot gnu dot org
2004-10-29  7:17 ` cvs-commit at gcc dot gnu dot org
2004-10-29  7:27 ` mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).