Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Seth C. Goldstein
Thu, 12 Nov 1992 07:39
gcc 2.2.2 c++ bug
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads