public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wilco at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/114843] aarch64: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return
Date: Thu, 25 Apr 2024 23:51:20 +0000	[thread overview]
Message-ID: <bug-114843-4-bAUTkOB0Fx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114843-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114843

Wilco <wilco at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilco at gcc dot gnu.org

--- Comment #10 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #9)
> Just a quick note here. Even though eh_return pattern was removed with
> r7-6051-g8144a493ddc008, it was broken before that patch.

Yeah I only fixed the broken behaviours that I encountered at the time - no
tests tried to return a value on the non-exception path. There is no clear
specification (eg. making it clear that EH_RETURN_DATA_REGNO must not overlap
with registers used to return or if they do, you need to conditionally restore
them), so no wonder that many targets get this wrong. Who knew that introducing
lots of complex builtins that affect prolog and epilog generation in a major
way to avoid a few lines of assembly code was such a bad idea...

Since the whole eh_return is an internal ABI in libgcc, a fix would be to
change EH_RETURN_DATA_REGNO(N) to avoid x0 and x1. Since eh_return already
reserves 7 registers(!) and now need to avoid using x0/x1 too, using x2-x5 and
x6,x7 and x9 for the other special registers should work.

  parent reply	other threads:[~2024-04-25 23:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25  6:31 [Bug libgcc/114843] New: AArch64: Wrong Register Reload in _Unwind_RaiseException causes corrupt return value on _URC_END_OF_STACK hugo at algoriddim dot com
2024-04-25  6:32 ` [Bug libgcc/114843] " hugo at algoriddim dot com
2024-04-25  6:45 ` [Bug target/114843] " pinskia at gcc dot gnu.org
2024-04-25  6:53 ` pinskia at gcc dot gnu.org
2024-04-25  7:10 ` pinskia at gcc dot gnu.org
2024-04-25  7:14 ` [Bug target/114843] aarch64: epoligue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return pinskia at gcc dot gnu.org
2024-04-25  7:16 ` pinskia at gcc dot gnu.org
2024-04-25  7:26 ` pinskia at gcc dot gnu.org
2024-04-25  7:52 ` pinskia at gcc dot gnu.org
2024-04-25  9:16 ` [Bug target/114843] aarch64: epilogue " pinskia at gcc dot gnu.org
2024-04-25 21:23 ` pinskia at gcc dot gnu.org
2024-04-25 23:51 ` wilco at gcc dot gnu.org [this message]
2024-04-25 23:55 ` pinskia at gcc dot gnu.org
2024-04-26  0:01 ` pinskia at gcc dot gnu.org
2024-04-26  0:03 ` wilco at gcc dot gnu.org
2024-04-26  0:31 ` pinskia at gcc dot gnu.org
2024-04-26  1:31 ` pinskia at gcc dot gnu.org
2024-04-26 17:09 ` pinskia at gcc dot gnu.org
2024-04-26 17:48 ` wilco at gcc dot gnu.org
2024-04-26 18:39 ` pinskia at gcc dot gnu.org
2024-04-26 22:22 ` pinskia at gcc dot gnu.org
2024-05-06  0:14 ` pinskia at gcc dot gnu.org

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=bug-114843-4-bAUTkOB0Fx@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).