🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by bothner Wed, 08 Feb 1989 01:18
Structure parameter bug in g++ 1.32
#1679
Author: bothner
Date: Wed, 08 Feb 1989 01:18
61 lines
1525 bytes
The following test program works using cfront 1.2, but fails under
g++ 1.32:

class StringOwn {
public:
    char * own;
};
inline StringOwn StrOwn(char * s) { StringOwn o; o.own = s; return o; }

char * F(StringOwn o) { return o.own; }

main()
{
    printf(F(StrOwn("hello")));
}

/usr/local/lib/gcc-c++ tst.C -quiet -version -o tst.s
GNU C++ version 1.32.0 (vax) compiled by GNU C version 1.32.

#NO_APP
gcc_compiled.:
.text
	.align 1
.globl _F
_F:
	.word 0x0
	movl 4(ap),r1
	movl r1,r0
	ret
	ret
	.align 0
LC0:
	.ascii "hello\0"
	.align 1
.globl _main
_main:
	.word 0x0
	subl2 $8,sp
	movab LC0,r0
	subl3 $4,fp,r1
	movl r0,-8(fp)
	movl -8(fp),r1
	movl r1,r2
	jbr L4
	jbr L4
L3:
L4:
	pushl -4(fp)
	calls $1,_F
	movl r0,r0
	pushl r0
	calls $1,_printf
	ret

The problem is the instruction after L4. It pushed -4(fp), which was never
set. If it pushed -8(fp) (or if it were a no-op) the code would work.
(Running with -O works, btw.)

	--Per
P.S. Tiemann's address at the end of README is c/o INRIA, and his
address in g++.texinfo is c/o MCC. Surely both of these are obsolete?
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads