Article View: gnu.gcc.bug
Article #1377gcc 2.2.2 c++ bug
From: Seth C. Goldstein
Date: Thu, 12 Nov 1992 07:39
Date: Thu, 12 Nov 1992 07:39
61 lines
1758 bytes
1758 bytes
Machine: sparc
Version: gcc version 2.2.2
OS: SunOS Release 4.1.2
problem: if static member function is declared with a <classname>::
before its name no error message is generated AND
it is compiled to take an implicit 'this' argument.
Example code:
--------------------------------------------------------
class Frame
{
int cb;
public:
inline Frame(void);
static void Frame::initialize(int arg1);
};
void
Frame::initialize(int arg1)
{
printf("%d\n", arg1);
}
--------------------------------------------------------
generates the following assembly code when compiled as follows:
--------------------------------------------------------
gcc -S -o bad.s bad.C
--------------------------------------------------------
gcc2_compiled.:
.text
.align 8
LC0:
.ascii "%d\12\0"
.align 4
.global _initialize__5Framei
.proc 020
_initialize__5Framei:
!#PROLOGUE# 0
save %sp,-112,%sp
!#PROLOGUE# 1
mov %i0,%l0
st %i1,[%fp+72]
sethi %hi(LC0),%o1
or %o1,%lo(LC0),%o0
ld [%fp+72],%o1
call _printf,0
nop
b,a L2
b,a L1
L2:
L1:
ret
restore
--------------------------------------------------------
Notice two input arguments. This goes away if the declaration for initialize
is instead written:
static void initialize(int arg1);
-sethg
Technical Details
Message-ID:
<9211122339.AA17127@boing.CS.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!convex!news.utdallas.edu!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.berkeley.edu!sethgShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!convex!news.utdallas.edu!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.berkeley.edu!sethg From: sethg@cs.berkeley.edu (Seth C. Goldstein) Subject: gcc 2.2.2 c++ bug Message-ID: <9211122339.AA17127@boing.CS.Berkeley.EDU> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 12 Nov 1992 07:39:13 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 62