possible bug in newlib-1.18.0/newlib/libc/machine/i386/setjmp.S
Corinna Vinschen
vinschen@redhat.com
Wed Nov 17 03:29:00 GMT 2010
On Nov 4 15:40, Andrew Makhorin wrote:
> 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)
> . . .
Thanks for the hint. I applied a matching patch.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
More information about the Newlib
mailing list