From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 70DA63858D3C; Tue, 30 Apr 2024 01:09:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 70DA63858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714439392; bh=zSI2tKmKW++2194NQ+HanGYWeIz2EYdTcdyOQfKf84M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RWOvUDx2aZf4PvHOc8N1IwoWUObx4UeEhWHJCsrIcsWVj771uQWwAhq+n+2yLnA2c bioAm0hzHbRAp8fjn5859rkxDb0/gBQSqW6JoGFWSA2qXAtwe8m37fjdYHyhPB0qzC ernuDaTnhIMqNi3FVkErFRAJU107p0mY8zfekZLE= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114848] loongarch: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return Date: Tue, 30 Apr 2024 01:09:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114848 --- Comment #6 from GCC Commits --- The releases/gcc-12 branch has been updated by LuluCheng : https://gcc.gnu.org/g:bb78099d2624b52c781ed6e5d85e43d54c3cda1a commit r12-10403-gbb78099d2624b52c781ed6e5d85e43d54c3cda1a Author: Yang Yujie Date: Fri Dec 8 18:01:18 2023 +0800 LoongArch: Fix eh_return epilogue for normal returns. On LoongArch, the regitsters $r4 - $r7 (EH_RETURN_DATA_REGNO) will be s= aved and restored in the function prologue and epilogue if the given function calls __builtin_eh_return. This causes the return value to be overwritten on normal return paths and breaks a rare case of libgcc's _Unwind_RaiseException. gcc/ChangeLog: PR target/114848 * config/loongarch/loongarch.cc: Do not restore the saved eh_re= turn data registers ($r4-$r7) for a normal return of a function that calls __builtin_eh_return elsewhere. * config/loongarch/loongarch-protos.h: Same. * config/loongarch/loongarch.md: Same. gcc/testsuite/ChangeLog: * gcc.target/loongarch/eh_return-normal-return.c: New test. (cherry picked from commit 4b421728289e6f1caa0dfaa953a11698ab95d37d)=