This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
possible bug in newlib-1.18.0/newlib/libc/machine/i386/setjmp.S
- From: Andrew Makhorin <mao at gnu dot org>
- To: newlib at sources dot redhat dot com
- Date: Thu, 04 Nov 2010 15:40:12 +0300
- Subject: possible bug in newlib-1.18.0/newlib/libc/machine/i386/setjmp.S
Hello,
I think that I found a bug in
newlib-1.18.0/newlib/libc/machine/i386/setjmp.S .
Namely, if longjmp is called with zero val (second argument), it causes
setjmp to return 0 rather than 1.
Probably the bug can be fixed as follows:
SYM (longjmp):
pushl ebp
movl esp,ebp
movl 8(ebp),edi /* get jmp_buf */
movl 12(ebp),eax /* store retval in j->eax */
+ test eax,eax
+ jnz skip
+ inc eax /* if eax = 0 then eax := 1 */
+skip:
movl eax,0(edi)
. . .
Thank you,
Andrew Makhorin