Bug 9304 - ICE in gen_subprogram_die
Summary: ICE in gen_subprogram_die
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: pch (show other bugs)
Version: 3.4.0
: P3 normal
Target Milestone: 3.4.0
Assignee: Geoff Keating
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2003-01-14 03:36 UTC by ritzert
Modified: 2003-07-25 17:33 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
gen_subprogram_die.tar.bz2 (82.57 KB, application/octet-stream)
2003-05-21 15:17 UTC, ritzert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ritzert 2003-01-14 03:36:02 UTC
$ g++ -g -O2 -o StdAfx.h.pch StdAfx.h
$ g++ -g -O2 configfile.cpp
StdAfx.h: In static member function `static size_t
   std::char_traits<wchar_t>::length(const wchar_t*)':
StdAfx.h:15161:   instantiated from `std::basic_string<_CharT, _Traits, _Alloc>
std::operator+(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = wchar_t, _Traits = std::char_traits<wchar_t>, _Alloc = std::allocator<wchar_t>]'
configfile.cpp:19:   instantiated from here
StdAfx.h:15161: internal compiler error: in gen_subprogram_die, at dwarf2out.c:
   10752

Doesn't ICE when not using pch.

I've attached the StdAfx.h file that includes libstdc++ headers
and the StdAfx.ii file without includes.
sed 's/^#.*$//' StdAfx.ii > StdAfx.h
give a StdAfx.h file that also provokes the ICE.

Release:
gcc version 3.4 20030113 (experimental)

Environment:
i686-pc-linux-gnu

How-To-Repeat:
mkdir tmp
cd tmp
tar xfj gen_subprogram_die.tar.bz2
g++ -g -O2 -o StdAfx.h.pch StdAfx.h
g++ -g -O2 configfile.cpp
Comment 1 Wolfgang Bangerth 2003-02-01 21:03:51 UTC
State-Changed-From-To: open->feedback
State-Changed-Why: I get a lot of weird error messages about "File number XX
    already used" from a snapshot from 2003-01-12, but no ICE.
    I don't get these error messages, no ICE, but several
    link failures from a recent snapshot (2003-01-30), but
    as far as I can see the functions that the compiler
    complains about are really not there (see below for output).
    
    Could you possibly retry and see whether this now works
    for you?
    
    Thanks
      W.
    
    test/x> ../../bin/gcc-2003-01-30/bin/c++ -g -O2 configfile.cpp
    /usr/lib/crt1.o: In function `_start':
    /usr/lib/crt1.o(.text+0x18): undefined reference to `main'
    /usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 14.
    /usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 14.
    /usr/bin/ld: Dwarf Error: Invalid or unhandled FORM value: 14.
    /tmp/ccaXYMqI.o: In function `CFEntryNotFoundException::CFEntryNotFoundException[not-in-charge]()':
    :5: undefined reference to `Exception::Exception[not-in-charge]()'
    /tmp/ccaXYMqI.o: In function `CFEntryNotFoundException::CFEntryNotFoundException[in-charge]()':
    :5: undefined reference to `Exception::Exception[not-in-charge]()'
    /tmp/ccaXYMqI.o: In function `CFParseException::CFParseException[not-in-charge](std::basic_string<wchar_t,
    std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)':
    :11: undefined reference to `Exception::Exception[not-in-charge]()'
    /tmp/ccaXYMqI.o: In function `CFParseException::CFParseException[in-charge](std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)':
    :11: undefined reference to `Exception::Exception[not-in-charge]()'
    /tmp/ccaXYMqI.o: In function `ConfigFile::ConfigFile[not-in-charge](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
    :18: undefined reference to `s2w(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /tmp/ccaXYMqI.o: In function `ConfigFile::ConfigFile[in-charge](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
    :18: undefined reference to `s2w(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    collect2: ld returned 1 exit status
Comment 2 ritzert 2003-02-03 19:19:38 UTC
From: Ritzert@t-online.de (Michael Ritzert)
To: bangerth@dealii.org,
 gcc-bugs@gcc.gnu.org,
 gcc-prs@gcc.gnu.org,
 nobody@gcc.gnu.org,
 gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/9304: [pch] ICE in gen_subprogram_die
Date: Mon, 3 Feb 2003 19:19:38 +0100

 On the unstripped code (confidential) I now get
 
 [loads of warnings]
 configfile.cpp:46: internal compiler error: in write_unscoped_name, at
    cp/mangle.c:791
 
 I will try to strip it down again so that this particular error remains as I 
 find the time to do so.
 
 Michael
 

Comment 3 Wolfgang Bangerth 2003-02-04 08:38:14 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Michael Ritzert <Ritzert@t-online.de>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/9304: [pch] ICE in gen_subprogram_die
Date: Tue, 4 Feb 2003 08:38:14 -0600 (CST)

 > I will see what I am doing wrong and report back.
 
 I guess you do, but can you also say whether this is a recent snapshot, or 
 from which date it stems?
 
 Maybe the fact that I don't see the problem comes from my using a newer 
 (and fixed) version.
 
 Thanks
   W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 

Comment 4 ritzert 2003-02-04 12:03:36 UTC
From: Ritzert@t-online.de (Michael Ritzert)
To: bangerth@dealii.org,
 gcc-bugs@gcc.gnu.org,
 gcc-prs@gcc.gnu.org,
 nobody@gcc.gnu.org,
 gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/9304: [pch] ICE in gen_subprogram_die
Date: Tue, 4 Feb 2003 12:03:36 +0100

 Am Montag, 3. Februar 2003 19:19 schrieb Michael Ritzert:
 > On the unstripped code (confidential) I now get
 >
 > [loads of warnings]
 > configfile.cpp:46: internal compiler error: in write_unscoped_name, at
 >    cp/mangle.c:791
 
 Hmm. There were so many warning that I oversaw this at the very beginning:
 
 /usr/include/sys/cdefs.h:31:3: #error "You need a ISO C conforming compiler to 
 use the glibc headers"
 
 with cdefs.h:31 being
 
 #if defined __GNUC__ && !defined __STDC__
 # error "You need a ISO C conforming compiler to use the glibc headers"
 #endif
 
 I will see what I am doing wrong and report back.
 
 Michael
 

Comment 5 ritzert 2003-02-04 19:38:50 UTC
From: Ritzert@t-online.de (Michael Ritzert)
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/9304: [pch] ICE in gen_subprogram_die
Date: Tue, 4 Feb 2003 19:38:50 +0100

 On February 4th 2003 15:38 schrieb Wolfgang Bangerth:
 > > I will see what I am doing wrong and report back.
 >
 > I guess you do, but can you also say whether this is a recent snapshot, or
 > from which date it stems?
 
 Reading specs from /opt/gcc-HEAD/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
 Configured with: /home/ritzert/gcc/HEAD/gcc/configure --enable-threads=posix 
 --prefix=/opt/gcc-HEAD
 Thread model: posix
 gcc version 3.4 20030202 (experimental)
 
 I looked into it briefly, but I can't find anything obvious I'm doing wrong.
 - I'm compiling the header and the actual source file with exactly the same 
 flags.
 - When I don't use pch the error disappears.
 - When I try to reproduce with preprocessed sources where I replace the 
 content of the header in question with #include <cdefs.h>, I can't reproduce 
 it.
 
 So all I can say ATM is that "strange things happen"...
 
 I will compile today's CVS over night and test again.
 
 Michael
 

Comment 6 ritzert 2003-02-04 19:53:32 UTC
From: Ritzert@t-online.de (Michael Ritzert)
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/9304: [pch] ICE in gen_subprogram_die
Date: Tue, 4 Feb 2003 19:53:32 +0100

 To be 100% clear, I should add:
 - I'm not talking about the testcase in the bugreport, but about the original 
 sourcefile the testcase was extracted from.
 - Compiling other sourcefiles against the very same PCH using the same 
 Makefile works just fine.
 
 Michael
 

Comment 7 ritzert 2003-02-04 22:45:51 UTC
From: Ritzert@t-online.de (Michael Ritzert)
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/9304: [pch] ICE in gen_subprogram_die
Date: Tue, 4 Feb 2003 22:45:51 +0100

 Ok, some more info:
 
 StdAfx.h: empty(!)
 
 configfile.cpp:
 #include "StdAfx.h"
 #include <iostream>
 
 ============================================================================
 i686-pc-linux-gnu  20030202
 -----------------
 ritzert@liz:~/NFS/test/pch$ c++ -g -O2 -fPIC -c StdAfx.h
 ritzert@liz:~/NFS/test/pch$ c++ -g -O2 -fPIC -c configfile.cpp
 In file included from /opt/gcc-HEAD/include/c++/3.4/iostream:46,
                  from configfile.cpp:2:
 /opt/gcc-HEAD/include/c++/3.4/istream:767: internal compiler error: 
 Segmentation
    fault
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 ritzert@liz:~/NFS/test/pch$ c++ -g -O2 -fPIC -pthread -c configfile.cpp
 In file included from /opt/gcc-HEAD/include/c++/3.4/iostream:46,
                  from configfile.cpp:3:
 /opt/gcc-HEAD/include/c++/3.4/istream:767: internal compiler error: 
 Segmentation
    fault
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 
 ============================================================================
 i386-unknown-freebsd4.7  20030203:
 -----------------------
 -bash-2.05b$ g++    -fPIC   -c StdAfx.h
 -bash-2.05b$ g++    -fPIC   -c configfile.cpp 2>&1 | head
 In file included from /home/ritzert/gcc-HEAD/install/include/c++/3.4/ios:50,
                  from 
 /home/ritzert/gcc-HEAD/install/include/c++/3.4/ostream:45,
                  from 
 /home/ritzert/gcc-HEAD/install/include/c++/3.4/iostream:45,
                  from configfile.cpp:3:
 /home/ritzert/gcc-HEAD/install/include/c++/3.4/streambuf:-23783: internal 
 compiler error: Segmentation
    fault
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 
 
 ============================================================================
 alpha-unknown-linux-gnu  20030131 - works
 -----------------------
 
 Michael
 

Comment 8 Wolfgang Bangerth 2003-02-04 22:54:11 UTC
Responsible-Changed-From-To: unassigned->geoffk
Responsible-Changed-Why: Author of PCH
Comment 9 Wolfgang Bangerth 2003-02-04 22:54:11 UTC
State-Changed-From-To: feedback->open
State-Changed-Why: I think we must leave this to the author of PCH. I still
    don't see the ICE on my system...
Comment 10 ritzert 2003-02-04 23:20:06 UTC
From: Ritzert@t-online.de (Michael Ritzert)
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/9304: [pch] ICE in gen_subprogram_die
Date: Tue, 4 Feb 2003 23:20:06 +0100

 The bootstrap of gcc HEAD just finished and now I get for the testcase in the 
 bugreport:
 
 ritzert@liz:~/tmp$ g++ -v
 Reading specs from /opt/gcc-HEAD/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
 Configured with: /home/ritzert/gcc/HEAD/gcc/configure --enable-threads=posix 
 --prefix=/opt/gcc-HEAD
 Thread model: posix
 gcc version 3.4 20030204 (experimental)
 ritzert@liz:~/tmp$ g++ -g -O2 -o StdAfx.h.pch StdAfx.h
 ritzert@liz:~/tmp$ g++ -g -O2 -o configfile.lo configfile.cpp
 /opt/gcc-HEAD/include/c++/3.4/bits/basic_string.tcc: In static member function
    `static size_t std::char_traits<wchar_t>::length(const wchar_t*)':
 /opt/gcc-HEAD/include/c++/3.4/bits/basic_string.tcc:622:   instantiated from 
 `std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, 
 const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = wchar_t, 
 _Traits = std::char_traits<wchar_t>, _Alloc = std::allocator<wchar_t>]'
 configfile.cpp:19:   instantiated from here
 /opt/gcc-HEAD/include/c++/3.4/bits/basic_string.tcc:622: internal compiler 
 error: in
    gen_subprogram_die, at dwarf2out.c:10784
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 
 Seems I plain forgot to test the initial testcase earlier...
 
 Michael
 
 PS: On FreeBSD 4.7, I get for the testcase with s/wstring/string/, s/L"/"/:
 [...]
 configfile.cpp:15:   instantiated from here
 /home/ritzert/gcc-HEAD/install/include/c++/3.4/bits/stl_construct.h:125: 
 internal compiler error: Segmentation
    fault
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 
 Looks like yet another different error...
 
Comment 11 Geoff Keating 2003-02-04 23:30:21 UTC
State-Changed-From-To: open->suspended
State-Changed-Why: I don't have access to hardware to reproduce this problem; Darwin has neither wide character support nor DWARF2.  Perhaps the bug will turn up for someone else later.
Comment 12 michael.ritzert 2003-02-05 11:13:30 UTC
From: Michael Ritzert <michael.ritzert@realtech.de>
To: gcc-gnats@gcc.gnu.org, geoffk@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org
Subject: Re: c++/9304: [pch] ICE in gen_subprogram_die
Date: Wed, 5 Feb 2003 11:13:30 +0100

 Important info: The error on the testcase in the bugreport only appears o=
 n=20
 Debian GNU/Linux unstable, but not on SuSE Linux 7.3 (using identical=20
 versions of gcc). So if you can't reproduce it, it is likely due to a=20
 different environment.
 
 If somebody wants to try and reproduce the error, just ask me in private =
 mail=20
 to produce another preprocessed testcase. For some reason I can no longer=
 =20
 compile the one in the bugreport (StdAfx.h:18891: error:=20
 `_M_c_locale_codecvt' has not been declared) - propably because of the=20
 stricter parser.
 
 Michael
 
Comment 13 INCORRECT EMAIL ADDRESS! 2003-04-22 10:28:16 UTC
From: Geoffrey Keating <geoffk@apple.com>
To: gcc-gnats@gcc.gnu.org, geoffk@gcc.gnu.org, ritzert@t-online.de,
   gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: c++/9304: [pch] ICE in gen_subprogram_die
Date: Tue, 22 Apr 2003 10:28:16 -0700

 Does this bug still happen with top-of-tree?  There have been several 
 DWARF-and-PCH-related changes since this bug was filed.
 
 -- 
 Geoff Keating <geoffk@apple.com>
 
Comment 14 Geoff Keating 2003-04-22 17:29:37 UTC
State-Changed-From-To: suspended->feedback
State-Changed-Why: Waiting for confirmation the bug still exists.
Comment 15 Geoff Keating 2003-04-23 18:00:12 UTC
State-Changed-From-To: feedback->closed
State-Changed-Why: From: Ritzert@t-online.de
    Date: Wed Apr 23, 2003  3:30:23  AM US/Pacific
    
    Hi,
    
    I was just about to report this bug closed. I had a testcase for the
    report in my tree that did not fail tonight. I guess this patch fixed
    it:
    
    2003-04-22  Geoffrey Keating  <geoffk@apple.com>
    	Loren James Rittle  <ljrittle@acm.org>
    
    	* dwarf2out.c (fde_table_allocated): Mark with GTY.
    [...]
    
    Thanks,
    Michael