jdf@ccvi.ccv.fr (Jean-Daniel Fekete) (07/05/89)
The following C program makes gcc produce wrong assembly code. It
should compute the substraction in long and coerce it to word or
am I wrong ?
------------------------------------
void MakeName(char *, unsigned short, void *);
char buffer[10];
foo(void *ret)
{
char *s;
s = buffer + 10;
MakeName(buffer, s - buffer, ret);
}
------------------------------------
.file "gccdump"
.version "GNU C 1.35"
gcc_compiled.:
foo .text
.align 4
.globl foo
foo:
pushl %ebp
movl %esp,%ebp
subl $4,%esp
movl $buffer,%ecx
addl $10,%ecx
movl %ecx,-4(%ebp)
pushl 8(%ebp)
* movw -4(%ebp),%ax
* movw $buffer,%dx
* subw %dx,%ax
* movzwl %ax,%eax
* pushl %eax
pushl $buffer
call MakeName
.L1:
leave
ret
.comm buffer,10
time in parse: 0.033332
time in integration: 0.000000
time in jump: 0.000000
time in cse: 0.000000
time in loop: 0.000000
time in flow: 0.000000
time in combine: 0.000000
time in local-alloc: 0.000000
time in global-alloc: 0.016666
time in final: 0.016666
time in varconst: 0.000000
time in symout: 0.000000
time in dump: 0.000000