Subject: G++ 4.1.2 internal segfault (ICE)
To: None <netbsd-bugs@NetBSD.org>
From: None <labau@gmail.com>
List: netbsd-bugs
Date: 04/17/2007 15:04:56
>Submitter-Id:	net
>Originator:	Mickael Labau
>Organization:	none, personal use only
>Confidential:	no
>Synopsis:	G++ 4.1.2 internal segfault (ICE)  
>Severity:	non-critical
>Priority:	medium
>Category:	bin
>Class:		support
>Release:	3.0.1 
>Environment:	NetBSD solo 3.0.1 NetBSD 3.0.1 (GENERIC-FLOP-SM-BOOTLAN) #6: Thu Aug 10 16:04:04 CEST 2006  root@dt:/usr/src/sys/arch/i386/compile/GENERIC-FLOP-SM-BOOTLAN i386

>Description:
G++ 4.1.2 gives an Internal Compiler Error (ICE)
(class "ice-on-legal-code")
on this snippet (see "How to repeat this problem")

__FUNCTION__ or static method cause internal segfault
>How-To-Repeat:
// Version g++ 4.1.2

class CLASS
{
  // If i remove this line it works
  static unsigned long& OneVar()
  { static unsigned long v = 0; return v; }

public:

  template<typename Ty>
  static const Ty& Get(const char * const function,
                       const Ty default_value)
  {
    return default_value;
  }
};

bool run(int& stat)
{
  // If i replace __FUNCTION__ by __PRETTY_FUNCTION__ it works !
  for (int i = CLASS::Get<int>(__FUNCTION__, 100); i; --i)
    return true;
}

int main()
{
}

>Fix:
replace __FUNCTION__ by __PRETTY_FUNCTION__
OR
remove the static method