public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114846] New: powerpc: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return
@ 2024-04-25  7:34 pinskia at gcc dot gnu.org
  2024-04-25  9:23 ` [Bug target/114846] " linkw at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-25  7:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114846
           Summary: powerpc: 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: powerpc64-linux-gnu powerpc-linux-gnu

I reduced an miscompile for aarch64 inside _Unwind_RaiseException and I noticed
the same issue can be reproduced on powerpc64-linux-gnu and powerpc-linux-gnu.

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).
```
        li 3,5
        li 10,0
.L4:
        ld 2,40(1)
        ld 4,-24(1)
        ld 5,-16(1)
        ld 6,-8(1)
        ld 3,-32(1)
        add 1,1,10
        blr
```

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2024-06-24  3:50 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25  7:34 [Bug target/114846] New: powerpc: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return pinskia at gcc dot gnu.org
2024-04-25  9:23 ` [Bug target/114846] " linkw at gcc dot gnu.org
2024-04-25  9:25 ` linkw at gcc dot gnu.org
2024-04-25 21:37 ` pinskia at gcc dot gnu.org
2024-04-29  5:20 ` linkw at gcc dot gnu.org
2024-04-29  9:04 ` linkw at gcc dot gnu.org
2024-05-14  8:49 ` linkw at gcc dot gnu.org
2024-05-29  2:15 ` cvs-commit at gcc dot gnu.org
2024-05-29  2:33 ` linkw at gcc dot gnu.org
2024-05-29 12:30 ` bergner at gcc dot gnu.org
2024-05-29 12:50 ` linkw at gcc dot gnu.org
2024-06-21 19:53 ` bergner at gcc dot gnu.org
2024-06-23 19:42 ` segher at gcc dot gnu.org
2024-06-24  1:43 ` cvs-commit at gcc dot gnu.org
2024-06-24  1:45 ` cvs-commit at gcc dot gnu.org
2024-06-24  1:46 ` cvs-commit at gcc dot gnu.org
2024-06-24  1:49 ` cvs-commit at gcc dot gnu.org
2024-06-24  3:46 ` linkw at gcc dot gnu.org
2024-06-24  3:50 ` linkw 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).