[Bug target/114848] loongarch: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114848 Xi Ruoyao changed: What|Removed |Added Resolution|--- |FIXED Target Milestone|--- |12.4 Status|UNCONFIRMED |RESOLVED --- Comment #8 from Xi Ruoyao --- Fixed for 12 and 13.
[Bug target/114848] loongarch: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114848 --- Comment #7 from GCC Commits --- The releases/gcc-13 branch has been updated by LuluCheng : https://gcc.gnu.org/g:88f22217521564e1a956e14ac55456caa160e055 commit r13-8661-g88f22217521564e1a956e14ac55456caa160e055 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 saved 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_return 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)
[Bug target/114848] loongarch: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114848 --- 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 saved 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_return 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)
[Bug target/114848] loongarch: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114848 --- Comment #5 from chenglulu --- (In reply to Xi Ruoyao from comment #3) > (In reply to Andrew Pinski from comment #2) > > (In reply to Xi Ruoyao from comment #1) > > > Hmm, AFAIK this should be already fixed with r14-6440? > > > > > > I cannot reproduce it with r14-9823 but maybe it has regressed again in > > > the > > > recent weeks. > > > > Oh I only tested gcc 13.2.0. If it is fixed you can close it. > > Hmm it looks like we need a backport to releases/gcc-13 (and 12?) I have backpointed r14-6440 to gcc-13 and gcc-12 and am testing > > I thought the bug was introduced by my shrink-wrap change (r14-545) so I > didn't proposed a backport. But it seems I was wrong and the bug exists > even before r14-545.
[Bug target/114848] loongarch: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114848 --- Comment #4 from Andrew Pinski --- Also it looks like I messed up comment #0 and forgot to change powerpc to longarch64 :). That is what I get for trying to split this all out.
[Bug target/114848] loongarch: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114848 Xi Ruoyao changed: What|Removed |Added Summary|longarch: epilogue in |loongarch: epilogue in |_Unwind_RaiseException |_Unwind_RaiseException |corrupts return value due |corrupts return value due |to __builtin_eh_return |to __builtin_eh_return --- Comment #3 from Xi Ruoyao --- (In reply to Andrew Pinski from comment #2) > (In reply to Xi Ruoyao from comment #1) > > Hmm, AFAIK this should be already fixed with r14-6440? > > > > I cannot reproduce it with r14-9823 but maybe it has regressed again in the > > recent weeks. > > Oh I only tested gcc 13.2.0. If it is fixed you can close it. Hmm it looks like we need a backport to releases/gcc-13 (and 12?) I thought the bug was introduced by my shrink-wrap change (r14-545) so I didn't proposed a backport. But it seems I was wrong and the bug exists even before r14-545.