From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 7FEB63AC869E; Mon, 19 Dec 2022 09:38:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FEB63AC869E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1671442704; bh=jRh3aOsRC1EN5ra6E+5jOCXu4eGUZMfcltACqdc37Hg=; h=From:To:Subject:Date:From; b=ZhLaCINEt2izob65rkWBaJUmQ2mVN+7zxwfAP566rnlgOGvaVURB9CBpRQEAsFocW K0M6xbO6Nz91OoQfscKx7nqN3pFMz5uByo9zMmVmzMWWvP8z4lgPpYfjJh1uGQqNGn jdxgYtuC6RceDd+1wnzUHl/vXs9SGJiV+63IRFls= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Fix a bug in setjmp for MIPS o32/o64 FPXX/FP64 X-Act-Checkin: newlib-cygwin X-Git-Author: Giovanni Bajo X-Git-Refname: refs/heads/master X-Git-Oldrev: c8130c3fe8c7c662a94cd720bf62883bd628850f X-Git-Newrev: 9bba9c2bdd22b2011f1fa6da36e6bc6a70af42ec Message-Id: <20221219093824.7FEB63AC869E@sourceware.org> Date: Mon, 19 Dec 2022 09:38:23 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D9bba9c2bdd2= 2b2011f1fa6da36e6bc6a70af42ec commit 9bba9c2bdd22b2011f1fa6da36e6bc6a70af42ec Author: Giovanni Bajo AuthorDate: Sat Dec 17 15:47:23 2022 +0100 Commit: Corinna Vinschen CommitDate: Mon Dec 19 10:38:05 2022 +0100 Fix a bug in setjmp for MIPS o32/o64 FPXX/FP64 =20 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). =20 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/s= etjmp.S index 9a8b31d092f3..cfc1d517a04f 100644 --- a/newlib/libc/machine/mips/setjmp.S +++ b/newlib/libc/machine/mips/setjmp.S @@ -68,7 +68,7 @@ =20 #define FPR_LAYOUT \ and $8, $4, 4; \ - bne $8, $0, 1f; \ + beq $8, $0, 1f; \ GPR_OFFSET ($31, 22); \ addiu $4, $4, -4; \ 1: \