[clang] [clang][PowerPC] Add flag to enable compatibility with GNU for complex arguments (PR #77732)
George Koehler via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 28 14:36:39 PDT 2025
kernigh wrote:
I am distracted by issue #133507 (clang-19 miscompiles itself for PPC32), so I can't check this pull request right now. [My comment of August 29, 2023](https://reviews.llvm.org/D146942#4626773) had this example:
```
#include "complex.h"
double complex
third(int no, double complex no_again, double complex yes)
{
return yes;
}
```
gcc passed _yes_ on the stack, but clang with the 2023 patch split _yes_ between registers and the stack, so it was not yet compatible. Has the patch been fixed? I don't want clang to invent a 3rd complex ABI that is incompatible with both gcc and old clang.
> Unless there's some existing OS where clang is the platform compiler that wants to preserve the old ABI, but even if such a platform exists, I doubt there's anyone we can ask.
For 32-bit PowerPC, I believe that clang can target Linux, NetBSD, FreeBSD, and OpenBSD. There are complex math functions like [csqrt(3)](https://man.openbsd.org/csqrt.3). I believe that Linux and NetBSD compile these functions with gcc, while FreeBSD and OpenBSD compile them with clang. For OpenBSD, talk to me. For FreeBSD, I don't know.
I might want OpenBSD to switch back to gcc's ABI. OpenBSD 6.7 (in 2020) had changed its powerpc compiler from gcc to clang. This was before issue #56023 (in 2022) reported the ABI change. Back in 2020, nobody noticed OpenBSD's ABI change, but now, if I use gcc, I can't call csqrt(3). If clang switched to gcc's ABI, then gcc would work again.
https://github.com/llvm/llvm-project/pull/77732
More information about the cfe-commits
mailing list