public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114847] New: arm: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return
@ 2024-04-25 7:40 pinskia at gcc dot gnu.org
0 siblings, 0 replies; only message in thread
From: pinskia at gcc dot gnu.org @ 2024-04-25 7:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114847
Bug ID: 114847
Summary: arm: epilogue in _Unwind_RaiseException corrupts
return value due to __builtin_eh_return
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Target: arm-linux-gnueabi
I reduced an miscompile for aarch64 inside _Unwind_RaiseException and I noticed
the same issue can be reproduced on arm-linux-gnueabi also.
Reduced testcase:
```
__attribute__((noipa,noinline))
int f(int *a, long offset, void *handler)
{
if (*a == 5)
return 5;
__builtin_eh_return (offset, handler);
}
int main()
{
int t = 5;
if (f(&t, 0, 0) != 5)
__builtin_abort();
}
```
This produces a load in the epilogue part for the `return 5` path (which is
reduced from the end of stack path inside _Unwind_RaiseException).
```
ldr r0, [r0]
cmp r0, #5
bne .L2
movs r2, #0
.L4:
pop {r0, r1}
@ r2 needed
add sp, sp, r2
bx lr
```
r0 is clobbered by the pop.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-25 7:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25 7:40 [Bug target/114847] New: arm: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return pinskia at gcc dot gnu.org
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).