Bug 53617 - gcc crash when template class has a friend that is a template member function of a plain class
Summary: gcc crash when template class has a friend that is a template member functio...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 8.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-09-12 23:35 UTC by Need Real Name
Modified: 2007-04-18 16:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-02 18:23:40 UTC
Embargoed:


Attachments (Terms of Use)

Description Need Real Name 2001-09-12 23:35:24 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.16-22 i686)

Description of problem:
gcc crashes with a segmentation fault when compiling the following.

#include <iostream.h>

template<class T, class U> class pair;

class buffy
   {
public:

   template<class T, class U> void send(pair<T,U> &victim)
      {
      cout << '(' << victim.lhs << ',' << victim.rhs << "\n";
      };
   };

template<class T, class U> class pair
   {
private:

   T lhs;
   U rhs;

public:

   pair(T x, U y): lhs(x), rhs(y) {};

   friend void buffy::send<>(pair&);
   };


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. call code above bug.cpp
2. g++ -c bug.cpp
3.
	

Actual Results:  randesk1% g++ -c gnubug.cpp
gnubug.cpp:26: Internal error: Segmentation fault.
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.


Expected Results:  Should have compiled cleanly.
Does compile cleanly on IBM VisualAge v5.
Gets clean bill of health from Parasoft CodeWizard 4.0


Additional info:

randesk1% g++ -v -c gnubug.cpp
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2 -D__E
ONS -v -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ 
 -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posi
_NO_INLINE__ -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tu
6__ gnubug.cpp /tmp/ccmlfIcO.ii
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (cpplib) (i386 L
LF)
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-3
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1plus /tmp/ccmlfIcO.ii -quiet -
se gnubug.cpp -version -o /tmp/ccQzNS8w.s
GNU C++ version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (i386-redhat-lin
mpiled by GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-85).
gnubug.cpp:26: Internal error: Segmentation fault.
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
randesk1%

Comment 1 Alan Cox 2002-12-15 17:44:32 UTC
Still true in 3.2/8.0

Comment 2 Richard Henderson 2004-10-02 18:23:40 UTC
Fixed in 3.3.


Note You need to log in before you can comment on or make changes to this bug.