diff options
author | gkoehler <gkoehler@cvs.openbsd.org> | 2020-11-20 05:07:28 +0000 |
---|---|---|
committer | gkoehler <gkoehler@cvs.openbsd.org> | 2020-11-20 05:07:28 +0000 |
commit | 1d60a28f546d64b3ea2737d4a8609986f56585a6 (patch) | |
tree | 16a25a1f87af1d2ecf04498d047b857437c8dfc0 /gnu/llvm/clang | |
parent | f7cbc95e6f71f1b221ddff7ffa0c8e060360c372 (diff) |
Fix va_arg in C++, Objective-C on 32-bit powerpc
In the PPC32 SVR4 ABI, a va_list has copies of registers from the
function call. va_arg looked in the wrong registers for (the pointer
representation of) an object in Objective-C, and for some types in
C++. Fix va_arg to look in the general-purpose registers, not the
floating-point registers. Also fix va_arg for some C++ types, like a
member function pointer, that are aggregates for the ABI.
Anthony Richardby found the problem in Objective-C. Eli Friedman
suggested part of this fix.
Fixes https://bugs.llvm.org/show_bug.cgi?id=47921
I have submitted this diff as https://reviews.llvm.org/D90329
ok kettenis@
Diffstat (limited to 'gnu/llvm/clang')
-rw-r--r-- | gnu/llvm/clang/lib/CodeGen/TargetInfo.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gnu/llvm/clang/lib/CodeGen/TargetInfo.cpp b/gnu/llvm/clang/lib/CodeGen/TargetInfo.cpp index 46fe5871cb9..5f138dcaf54 100644 --- a/gnu/llvm/clang/lib/CodeGen/TargetInfo.cpp +++ b/gnu/llvm/clang/lib/CodeGen/TargetInfo.cpp @@ -4248,13 +4248,12 @@ Address PPC32_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAList, // }; bool isI64 = Ty->isIntegerType() && getContext().getTypeSize(Ty) == 64; - bool isInt = - Ty->isIntegerType() || Ty->isPointerType() || Ty->isAggregateType(); + bool isInt = !Ty->isFloatingType(); bool isF64 = Ty->isFloatingType() && getContext().getTypeSize(Ty) == 64; // All aggregates are passed indirectly? That doesn't seem consistent // with the argument-lowering code. - bool isIndirect = Ty->isAggregateType(); + bool isIndirect = isAggregateTypeForABI(Ty); CGBuilderTy &Builder = CGF.Builder; @@ -9677,7 +9676,8 @@ ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType Ty, bool IsFixed, uint64_t Size = getContext().getTypeSize(Ty); // Pass floating point values via FPRs if possible. - if (IsFixed && Ty->isFloatingType() && FLen >= Size && ArgFPRsLeft) { + if (IsFixed && Ty->isFloatingType() && !Ty->isComplexType() && + FLen >= Size && ArgFPRsLeft) { ArgFPRsLeft--; return ABIArgInfo::getDirect(); } |