🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

G++ 1.31 - Bugs (again)

#1578
From: Philippe Gautron
Date: Thu, 22 Dec 1988 16:52
88 lines
1972 bytes
version: G++ 1.31.0, GCC 1.31., libg++ 1.25.0
Machine: SUN 3/260, running SUN 0S 3.4

Configuration:	tm.h --> tm-sun3+.h
		md   --> m68k.md
		aux-output.c --> output.m68k.c

Bug fixes:	SUN3.README
		expr.c (article 244)
		stmt.c (article 245)

Symptoms:
	- ATT cfront 1.1: compiles (that's new!) but execution fails.

My previous message was about execution of ATT cfront
Execution aborts with bus error. We continue to work at home, so
more information follows.

1) Consider this C++ session:

struct expr{
   ~expr();
};

struct name: expr{
  ~name();
};

name::~name()
{
	this = 0;
}

2) C code that C++ generates is:

int _name__dtor (_auto_this , _auto__free )
    struct name *_auto_this ;
    int _auto__free ;

{
    if (_auto_this ){ 
        _auto_this = 0 ;
        if (_auto_this )    // <-- Remember this test
             _expr__dtor ( (struct expr *)_auto_this , _auto__free ) ;
    }
}

3) C++ + gcc generation:

.globl __name__dtor
__name__dtor:
	link a6,#0
	tstl a6@(8)
	jeq L2
	clrl a6@(8)
	tstl a6@(8)            # <-- test
	jeq L3
	movel a6@(12),sp@-
	movel a6@(8),sp@-
	jbsr __expr__dtor
	addqw #8,sp
L3:
L2:
L1:
	unlk a6
	rts
4) G++ generation

.globl __$_name
__$_name:
	link a6,#0
	addqw #8,sp
	tstl a6@(8)
	jeq L2
	clrl a6@(8)		# where is the test ?
	movel a6@(12),sp@-
	movel a6@(8),sp@-
	jbsr __$_expr
L2:
L1:
	unlk a6
	rts

To michael:
People at home are hurry and says me: Vacation, what vacation...

-- Philippe Gautron and Yvon Gourhant --
Technical Details
Message-ID: <8812221652.AA02169@corto.inria.fr>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!mcvax!sor.inria.fr!gautron

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!mcvax!sor.inria.fr!gautron
From: mcvax!sor.inria.fr!gautron@UUNET.UU.NET (Philippe Gautron)
Newsgroups: gnu.g++.bug
Subject: G++ 1.31 - Bugs (again)
Message-ID: <8812221652.AA02169@corto.inria.fr>
Date: 22 Dec 88 16:52:50 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 87