Bug 53617 - gcc crash when template class has a friend that is a template member function of a plain class
gcc crash when template class has a friend that is a template member functio...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
8.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-09-12 19:35 EDT by Need Real Name
Modified: 2007-04-18 12:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-02 14:23:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2001-09-12 19:35:24 EDT
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 12:44:32 EST
Still true in 3.2/8.0
Comment 2 Richard Henderson 2004-10-02 14:23:40 EDT
Fixed in 3.3.

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