Subject: bin/36164: G++ 4.1.2 internal segfault (ICE)
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <labau@gmail.com>
List: netbsd-bugs
Date: 04/17/2007 15:20:00
>Number:         36164
>Category:       bin
>Synopsis:       G++ 4.1.2 internal segfault (ICE)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 17 15:20:00 +0000 2007
>Originator:     Mickael Labau
>Release:        3.0.1
>Organization:
none, personal use only
>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