Bug 8384 - ICE in is_base_type, at dwarf2out.c:7477
Summary: ICE in is_base_type, at dwarf2out.c:7477
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: 3.3.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-28 09:16 UTC by W E Brown
Modified: 2003-06-12 00:15 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description W E Brown 2002-10-28 09:16:00 UTC
The following short program gives an internal compiler error with v3.2 when compiled with -g, but compiles correctly when -g flag is not used.

// ----------

template< class T >
T  fakemake();


template< class T >
struct Identity  {
  typedef  T  type;
};


template< class T, class U>
struct Result
  : public Identity< typeof( true ? fakemake<T>() : fakemake<U>() )>
{};


int main ()  {

  Result<short,int>::type  i = 0;
  return i;

}

Release:
gcc v3.2

Environment:
Cygwin
Comment 1 Wolfgang Bangerth 2002-10-28 09:39:07 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: 2.95 used to say:
    x.cc:14: sorry, not implemented: testing typeof_type for template parms
    x.cc:14: confused by earlier errors, bailing out
    
    
    3.2 and present CVS say this:
    x.cc: In instantiation of `Identity<__typeof ((true ? fakemake<T>() : fakemake<U>()))>':
    x.cc:14:   instantiated from here
    x.cc:6: internal compiler error: in is_base_type, at dwarf2out.c:7477
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
Comment 2 Wolfgang Bangerth 2002-10-28 13:50:05 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: debug/8384: ICE in is_base_type, at dwarf2out.c:7477
Date: Mon, 28 Oct 2002 13:50:05 -0600 (CST)

 Here's a shorter example:
 --------------------------------
 int foo;
 
 template <class T> struct Base  {
   typedef  T  type;
 };
 
 template<class T>
 struct Derived : public Base<typeof(foo)> {};
 -------------------------------
 
 Message is:
 -------------------------------
 tmp/g> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -g x.cc
 x.cc: In instantiation of `Base<__typeof (foo)>':
 x.cc:8:   instantiated from here
 x.cc:3: internal compiler error: in is_base_type, at dwarf2out.c:7477
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 -------------------------------
 
 I believe that if this problem is fixed, the code will still not compile 
 but the next issue will then be c++/8385.
 
 Regards
   Wolfgang
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
Comment 3 Andrew Pinski 2003-05-26 17:35:59 UTC
This is fixed on the mainline (20030526), I do not know if it works on 3.3, but since this is 
not a regression, I am closing as fixed:

tin:~/src/gnu/gcctest>g++ -g pr8384.cc -gdwarf-2
/usr/lib/crt1.o(.text+0x18): In function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status