This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: possible bug in newlib-1.18.0/newlib/libc/machine/i386/setjmp.S


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]