Article View: gnu.gcc.bug
Article #962Gnu C++ bugs in classes
From: A.APPLEYARD
Date: Wed, 19 Aug 1992 09:57
Date: Wed, 19 Aug 1992 09:57
128 lines
3888 bytes
3888 bytes
BUG REPORT:
Gnu C version 2.0 compiled etc and linked this program OK (as 'gcc t$$$.cc'):-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class scubadiver_catcher{public:
int i,j,k,l;
void call_into_action(char*s){j=strlen(s);};
void scubadiver_catcher::radio_for(char*s){k=strlen(s);};};
scubadiver_catcher Aphanistor;
main(){
Aphanistor.call_into_action("5 seen at Long Cove");
Aphanistor.radio_for("12 in 2 boats offshore from Black Rock Head");}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
But if I compiled it in 2 parts, as 'gcc t$$$1.cc t$$$2.cc':-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<<file t$$$1.cc>>
class scubadiver_catcher{public:
int i,j,k,l;
void call_into_action(char*s){j=strlen(s);};
void scubadiver_catcher::radio_for(char*s){k=strlen(s);};};
void dummy(){}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<<file t$$$2.cc>>
class scubadiver_catcher{public:
int i,j,k,l;
void call_into_action(char*s);
void scubadiver_catcher::radio_for(char*s);};
scubadiver_catcher Aphanistor;
main(){
Aphanistor.call_into_action("5 seen at Long Cove");
Aphanistor.radio_for("12 in 2 boats offshore from Black Rock Head");}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the linker said this:-
t$$$2.o: Undefined symbol scubadiver_catcher::call_into_action(char *) reference
d from text symbol
Note that '_call_into_action__18scubadiver_catcherPc:' is not declared as global
in assembler file t$$$1.s as produced bu Gnu C++ version 2.0 .
This bug was not present in the last version of Gnu C which I had (1.39?).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is the result of 'gcc t$$$1.cc t$$$2.cc -S':-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<<file t$$$1.s>>
.file "t$$$1.cc"
gcc2_compiled.:
.text
.align 2
_call_into_action__18scubadiver_catcherPc:
pushl %ebp
movl %esp,%ebp
pushl %ebx
movl 8(%ebp),%ebx
pushl 12(%ebp)
call _strlen
movl %eax,4(%ebx)
addl $4,%esp
jmp L2
.align 2,0x90
jmp L1
.align 2,0x90
L2:
L1:
movl -4(%ebp),%ebx
leave
ret
.align 2
.globl _radio_for__18scubadiver_catcherPc
_radio_for__18scubadiver_catcherPc:
pushl %ebp
movl %esp,%ebp
pushl %ebx
movl 8(%ebp),%ebx
pushl 12(%ebp)
call _strlen
movl %eax,8(%ebx)
addl $4,%esp
jmp L4
.align 2,0x90
jmp L3
.align 2,0x90
L4:
L3:
movl -4(%ebp),%ebx
leave
ret
.align 2
.globl _dummy__Fv
_dummy__Fv:
pushl %ebp
movl %esp,%ebp
jmp L6
.align 2,0x90
jmp L5
.align 2,0x90
L6:
L5:
leave
ret
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<<file t$$$2.s>>
.file "t$$$2.cc"
gcc2_compiled.:
.text
LC0:
.ascii "5 seen at Long Cove\0"
LC1:
.ascii "12 in 2 boats offshore from Black Rock Head\0"
.align 2
.globl _main
_main:
pushl %ebp
movl %esp,%ebp
call ___main
pushl $LC0
pushl $_Aphanistor
call _call_into_action__18scubadiver_catcherPc
pushl $LC1
pushl $_Aphanistor
call _radio_for__18scubadiver_catcherPc
addl $16,%esp
xorl %eax,%eax
jmp L1
.align 2,0x90
jmp L1
.align 2,0x90
L1:
leave
ret
.comm _Aphanistor,16
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID:
<MAILQUEUE-101.920819095701.745@fs1.metallurgy.umist.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!fs1.mt.umist.ac.UK!A.APPLEYARDShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!fs1.mt.umist.ac.UK!A.APPLEYARD From: A.APPLEYARD@fs1.mt.umist.ac.UK Subject: Gnu C++ bugs in classes Message-ID: <MAILQUEUE-101.920819095701.745@fs1.metallurgy.umist.ac.uk> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 19 Aug 1992 09:57:01 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 129