c++/6347: g++3.1: SEGV in check_initializer with typename

snyder@fnal.gov snyder@fnal.gov
Thu Apr 18 02:46:00 GMT 2002


>Number:         6347
>Category:       c++
>Synopsis:       g++3.1: SEGV in check_initializer with typename
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 18 02:46:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     scott snyder
>Release:        3.1 20020417 (prerelease)
>Organization:
>Environment:
System: Linux karma 2.4.9-13 #1 Tue Oct 30 20:11:04 EST 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../egcs/configure --prefix=/usr/local/egcs --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77 : (reconfigured) 
>Description:

I get an ICE compiling the source below:

$ cc1plus x.cc
 FillableMBTChannel<Item>::FillableMBTChannel() void f() void f() FillableMBTChannel<Item>::FillableMBTChannel() [with Item = int]
x.cc:29:   instantiated from here
x.cc:23: internal 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.
$

Here's where it's dying:

Program received signal SIGSEGV, Segmentation fault.
0x08063608 in check_initializer (decl=0x40188b60, init=0x0)
    at ../../egcs/gcc/cp/decl.c:7896
7896		  if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type))
(gdb) where
#0  0x08063608 in check_initializer (decl=0x40188b60, init=0x0)
    at ../../egcs/gcc/cp/decl.c:7896
#1  0x08064163 in cp_finish_decl (decl=0x40188b60, init=0x0, asmspec_tree=0x0, 
    flags=0) at ../../egcs/gcc/cp/decl.c:8276
...
(gdb) call debug_tree (core_type)
 <typename_type 0x40188a80 ItemType VOID
    align 8 symtab 0 alias set 0 context <record_type 0x40181cb0 ItemTraits<int>>
    chain <type_decl 0x40188af0 ItemType>>


It crashes because the lang_specific field of core_type is null.

>How-To-Repeat:

Compile this source:

-------------------------------------------------------
template <class Item>
struct MBTChannel
{
public:
  template <class U>
  struct ItemTraits {
    typedef int ItemType;
  };
};



template <class Item> 
struct FillableMBTChannel
{
  FillableMBTChannel();
};

template <class Item>
FillableMBTChannel<Item>::
FillableMBTChannel()
{
  typename MBTChannel<Item>::ItemTraits<int>::ItemType dummy;
}


void f()
{
  FillableMBTChannel<int> track;
}
-------------------------------------------------------

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list