Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ccvi.ccv.fr!jdf From: jdf@ccvi.ccv.fr (Jean-Daniel Fekete) Newsgroups: gnu.gcc.bug Subject: Bug in gcc 1.35 for sun386i Message-ID: <8907051035.AA03296@ccvi.ccv.fr> Date: 5 Jul 89 10:35:59 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 61 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