🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1854

segfault in g++ 1.34.1

#1854
From: Ron Guilmette
Date: Tue, 11 Apr 1989 20:47
41 lines
1525 bytes
The following piece of code, if compiled with g++ 1.34.1 using the
-fall-virtual option, will cause the compiler to segfault.

The problem seems to have been that cplus-typeck.c contained an
incorrect test for "constructorness".  A trivial patch is provided
below.  This patch may fix some other related bugs as well.

// Options: -fall-virtual

class base {
public:
	void operator -> () (int, int, ...);
};

class derived : public base {
public:
	derived ();
};

void* p;

int test ()
{
	p = (void*) &derived::derived;		// SEGFAULT
}

*** ../cplus-typeck.c	Wed Mar 15 11:26:44 1989
--- cplus-typeck.c	Mon Mar 27 18:30:50 1989
***************
*** 3471,3475 ****
  		  && (TREE_HAS_METHOD_CALL_OVERLOADED (DECL_CONTEXT (t))
  		      || TREE_NEEDS_WRAPPER (DECL_CONTEXT (t)))
! 		  && ! TREE_IS_CONSTRUCTOR (TREE_TYPE (t))))
  	    {
  	      offset = copy_node (DECL_VINDEX (t));
--- 3471,3475 ----
  		  && (TREE_HAS_METHOD_CALL_OVERLOADED (DECL_CONTEXT (t))
  		      || TREE_NEEDS_WRAPPER (DECL_CONTEXT (t)))
! 		  && ! TREE_IS_CONSTRUCTOR (t)))
  	    {
  	      offset = copy_node (DECL_VINDEX (t));
Technical Details
Message-ID: <8904112047.AA17259@riunite.aca.mcc.com>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!MCC.COM!rfg

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!MCC.COM!rfg
From: rfg@MCC.COM (Ron Guilmette)
Newsgroups: gnu.g++.bug
Subject: segfault in g++ 1.34.1
Message-ID: <8904112047.AA17259@riunite.aca.mcc.com>
Date: 11 Apr 89 20:47:25 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 41