Subject: Problem with GNU C 2.4.5
To: None <netbsd-bugs@NetBSD.ORG>
From: None <fwmiller@cs.umd.edu>
List: netbsd-bugs
Date: 01/08/1995 20:31:21
This is my first submission to netbsd-bugs so don't flame me in I'm not
using the right protocol, tell me the right way to do it.
---
I am wondering if I have found a bug or not. Consider the following code
which was generated by the GNU 2.4.5 compiler supplied with NetBSD 1.0 to
a C function called "devWrite":
.globl _devWrite
.type _devWrite,@function
_devWrite:
pushl %ebp
movl %esp,%ebp
pushl %ebx
... [snip] ...
movl -4(%ebp),%ebx
leave
ret
All code paths lead to this end fragment. Notice however, that the register
%ebx that is pushed immediately after setting up the new stack frame is
not popped at the procedure's end. It appears that %ebx is being pushed onto
the stack at the beginning to protect it's value on entry for when the
function returns.
This occurrence is not isolated. Lots of other functions generate the same
sequence. On the other hand, lots of functions appear to generate the
"correct" sequence:
... [snip] ...
popl %ebx
leave
ret
I am at a loss. This problem causes some serious trouble at execution time
but seems to me that if it were a bug, should have been caught by now.
Can anyone help me,
FM
_______________________________________________
\
\ Frank W. Miller
\ Department of Computer Science
\ University of Maryland, College Park
\ Internet: fwmiller@cs.umd.edu
\_________________________________________