public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Fix a bug in setjmp for MIPS o32/o64 FPXX/FP64
Date: Mon, 19 Dec 2022 09:38:23 +0000 (GMT)	[thread overview]
Message-ID: <20221219093824.7FEB63AC869E@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=9bba9c2bdd22b2011f1fa6da36e6bc6a70af42ec

commit 9bba9c2bdd22b2011f1fa6da36e6bc6a70af42ec
Author:     Giovanni Bajo <rasky@develer.com>
AuthorDate: Sat Dec 17 15:47:23 2022 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Mon Dec 19 10:38:05 2022 +0100

    Fix a bug in setjmp for MIPS o32/o64 FPXX/FP64
    
    It seems there is a swapped logic in one of the subcases of
    setjmp.S for MIPS: when the FPU registers are 64-bit within
    a 32-bit aligned jmp_buf, the code realigns the pointers
    before doing 64-bit writes, but the branch logic is swapped:
    we must avoid the address adjustement when bit 2 is zero
    (that is, the address is already 8-byte aligned).
    
    This always triggers an address error when run, as tested
    on a MIPS VR4300 with O64 ABI.

Diff:
---
 newlib/libc/machine/mips/setjmp.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/machine/mips/setjmp.S b/newlib/libc/machine/mips/setjmp.S
index 9a8b31d092f3..cfc1d517a04f 100644
--- a/newlib/libc/machine/mips/setjmp.S
+++ b/newlib/libc/machine/mips/setjmp.S
@@ -68,7 +68,7 @@
 
 #define FPR_LAYOUT		\
 	and $8, $4, 4;	 	\
-	bne $8, $0, 1f;		\
+	beq $8, $0, 1f;		\
 	GPR_OFFSET ($31, 22);	\
 	addiu $4, $4, -4;	\
 1:				\

                 reply	other threads:[~2022-12-19  9:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221219093824.7FEB63AC869E@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).