bothner@WSL.DEC.COM (02/08/89)
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?