schmidt%bonnie.ics.uci.edu@orion.cf.uci.edu ("Douglas C. Schmidt") (09/27/88)
Bug Report for GCC:
-------------------
Problem : Using the profiling option produces bad asm code
for the Sequent Symmetry 386 port. I've marked
the problem in the asm code included below.
1.) Version : gcc 1.28
-----------
2.) Input Program :
-----------------
# 1 "veryfast.c"
# 1 "/usr/include/stdio.h"
extern struct _iobuf {
int _cnt;
char *_ptr;
char *_base;
int _bufsiz;
short _flag;
char _file;
} _iob[20 ];
struct _iobuf *fopen();
struct _iobuf *fdopen();
struct _iobuf *freopen();
long ftell();
char *gets();
char *fgets();
char *sprintf();
# 1 "veryfast.c"
static unsigned char access_table[] = {
0, 0, 0, 0, 0, 4, 4, 4, 4, 4,
4, 8, 13, 17, 17, 25, 25, 29, 35, 39,
44, 52, 56, 60, 66, 71, 74, 82, 87, 93,
100,100,103,108,110,119,119,122,128,135,
141,146,152,158,158,158,158,158,164,164,
164,164,164,164,168,168,176,176,178,178,
178,178,178,178,184,184,184,184,184,184,
184,184,184,190 };
static char *word_table =
"elsecaseconstautocontinuecharexternenumbreakregistergotolong \
returnwhileasmvolatilefloattypeoftypedefforuniondo__alignof \
intdoubledefaultinlineshortstructswitchstaticvoid \
unsignedifsizeofsigned";
inline static int hash(str,len)
register char *str;
register int len;
{
static int cval[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 3, 0, 8, 14, 6,
31, 0, 22, 17, 1, 33, 0, 0, 1, 14,
11, 0, 0, 0, 6, 35, 0, 16, 18, 19,
0, 0, 0, 0, 0, 0, 0, 0,
};
register int hval;
switch(hval = len) {
default:
hval += cval[(int)str[0]];
hval += cval[(int)str[len - 1]];
case 0:
return(hval);
}
}
inline static in_word_set(str,len)
register char *str;
register int len;
{
if (len >= 2 && len <= 9 ) {
register int key = hash(str,len);
if (key >= 4 && key <= 72 ) {
register int i = access_table[key];
register int j = access_table[key+1];
while (i < j) {
if (*str++ != word_table[i++]) {
return(0);
}
}
return(*str == '\0');
}
}
return(0);
}
main() {
char Buf[80];
int Len;
int i = 0;
while((Len = Get_Line(Buf,80)) != (-1) ) {
if (in_word_set(Buf,Len)) {
i++;
}
}
printf("i = %d\n",i);
}
3.) Command Used : gcc -p
----------------
4.) Files used :
--------------
tm.h -> tm-seq386.h
md -> i386.md
config.h -> config.i386.h
5.) Machine(s) used :
-------------------
Sequent Symmetry DYNIX (TM)V3 (BSD 4.3 features)
6.) Compiler diagnostics :
------------------------
Assembler:
"veryfast.c", line 232: "lea" is not followed by a ':' for a label definition
1.5 real 0.8 user 0.4 sys
7.) Asm output:
---------------
.file "yow.c"
.data
_access_table:
.byte 0
.byte 0
.byte 0
.byte 0
.byte 0
.byte 4
.byte 4
.byte 4
.byte 4
.byte 4
.byte 4
.byte 8
.byte 13
.byte 17
.byte 17
.byte 25
.byte 25
.byte 29
.byte 35
.byte 39
.byte 44
.byte 52
.byte 56
.byte 60
.byte 66
.byte 71
.byte 74
.byte 82
.byte 87
.byte 93
.byte 100
.byte 100
.byte 103
.byte 108
.byte 110
.byte 119
.byte 119
.byte 122
.byte 128
.byte 135
.byte 141
.byte 146
.byte 152
.byte 158
.byte 158
.byte 158
.byte 158
.byte 158
.byte 164
.byte 164
.byte 164
.byte 164
.byte 164
.byte 164
.byte 168
.byte 168
.byte 176
.byte 176
.byte 178
.byte 178
.byte 178
.byte 178
.byte 178
.byte 178
.byte 184
.byte 184
.byte 184
.byte 184
.byte 184
.byte 184
.byte 184
.byte 184
.byte 184
.byte 190
.text
LC0:
.ascii "elsecaseconstautocontinuecharexternenumbreakregistergotolong returnwhileasmvolatilefloattypeoftypedefforuniondo__alignof intdoubledefaultinlineshortstructswitchstaticvoid unsignedifsizeofsigned\0"
.data
.align 2
_word_table:
.long LC0
.align 2
_cval.0:
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 3
.long 0
.long 8
.long 14
.long 6
.long 31
.long 0
.long 22
.long 17
.long 1
.long 33
.long 0
.long 0
.long 1
.long 14
.long 11
.long 0
.long 0
.long 0
.long 6
.long 35
.long 0
.long 16
.long 18
.long 19
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.text
LC1:
.ascii "i = %d\12\0"
.align 2
.globl _main
_main:
pushl %ebp
movl %esp,%ebp
subl $112,%esp
pushl %ebx
pushl %esi
pushl %edi
.data
.align 2
LP0:
.long 0
.text
lea EAX,LP0 /* this looks like the culprit */
call mcount
movl $0,-88(%ebp)
L36:
pushl $80
leal -80(%ebp),%eax
pushl %eax
call _Get_Line
movl %eax,%eax
movl %eax,%eax
movl %eax,-84(%ebp)
leal 8(%esp),%esp
cmpl $-1,%eax
je L37
leal -80(%ebp),%eax
movl -84(%ebp),%edx
movl %edx,-108(%ebp)
leal -88(%ebp),%ecx
cmpl $1,-108(%ebp)
jle L40
cmpl $9,-108(%ebp)
jg L40
movl %eax,%esi
movl %edx,-112(%ebp)
leal -88(%ebp),%ebx
movl -112(%ebp),%ebx
cmpl $0,%ebx
je L44
jmp L43
L43:
movsbl (%esi),%edx
movl %edx,-92(%ebp)
movl %edx,%edi
addl _cval.0(,%edi,4),%ebx
movl -112(%ebp),%edi
movsbl -1(%esi,%edi),%edx
movl %edx,-96(%ebp)
movl %edx,%edi
addl _cval.0(,%edi,4),%ebx
L44:
movl %ebx,%ecx
jmp L41
L42:
L41:
cmpl $3,%ecx
jle L46
cmpl $72,%ecx
jg L46
movzbl _access_table(%ecx),%ebx
movzbl _access_table+1(%ecx),%edx
movl %edx,-112(%ebp)
L47:
cmpl -112(%ebp),%ebx
jge L48
movl %ebx,%esi
addl _word_table,%esi
incl %ebx
movb (%eax),%dl
movb %dl,-100(%ebp)
incl %eax
cmpb (%esi),%dl
je L49
xorl %esi,%esi
jmp L39
L49:
jmp L47
L48:
movl $0,-104(%ebp)
cmpb $0,(%eax)
jne L50
movl $1,-104(%ebp)
L50:
movl -104(%ebp),%esi
jmp L39
L46:
L40:
xorl %esi,%esi
jmp L39
L39:
cmpl $0,%esi
je L38
incl -88(%ebp)
L38:
jmp L36
L37:
pushl -88(%ebp)
pushl $LC1
call _printf
L35:
leal -124(%ebp),%esp
popl %edi
popl %esi
popl %ebx
leave
ret