Article View: gnu.gcc.bug
Article #961Gnu C++ bugs in classes
From: A.APPLEYARD
Date: Wed, 19 Aug 1992 09:57
Date: Wed, 19 Aug 1992 09:57
40 lines
1542 bytes
1542 bytes
BUG REPORT: In Gnu C version 2.0, static members of classes are not allocated
storage space, and thus the linker complains that these symbols are missing if
I use them.
This bug was not present in the last version of Gnu C which I had (1.39?).
Herewith a C++ program, and its translation into assembler by Gnu C++.
Notice that there is no assembler line 'comm __12mousecatcher$mice,4'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class mousecatcher{public:
int cat,ferret,owl,trap;
static int mice;};
int i,j,k; mousecatcher Tom;
main(){i=Tom.cat; j=Tom.ferret; k=Tom.mice;}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.file "t$$.cc"
gcc2_compiled.:
.text
.align 2
.globl _main
_main:
pushl %ebp
movl %esp,%ebp
call ___main
movl _Tom,%edx
movl %edx,_i
movl _Tom+4,%edx
movl %edx,_j
movl __12mousecatcher$mice,%edx
movl %edx,_k
xorl %eax,%eax
jmp L1
.align 2,0x90
jmp L1
.align 2,0x90
L1:
leave
ret
.comm _i,4
.comm _j,4
.comm _k,4
.comm _Tom,16
Technical Details
Message-ID:
<MAILQUEUE-101.920819095700.744@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.920819095700.744@fs1.metallurgy.umist.ac.uk> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 19 Aug 1992 09:57:00 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 41