Article View: gnu.g++.bug
Article #1679Structure parameter bug in g++ 1.32
From: bothner
Date: Wed, 08 Feb 1989 01:18
Date: Wed, 08 Feb 1989 01:18
61 lines
1525 bytes
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?
Technical Details
Message-ID:
<8902080118.AA21802@gilroy.pa.dec.com>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!WSL.DEC.COM!bothnerShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!WSL.DEC.COM!bothner From: bothner@WSL.DEC.COM Newsgroups: gnu.g++.bug Subject: Structure parameter bug in g++ 1.32 Message-ID: <8902080118.AA21802@gilroy.pa.dec.com> Date: 8 Feb 89 01:18:35 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 61