[PATCH] D90329: [PowerPC] Fix va_arg in Objective-C on 32-bit ELF targets
George Koehler via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 4 18:21:20 PST 2020
kernigh added inline comments.
================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:4723
+ bool isInt = Ty->isIntegerType() || Ty->hasPointerRepresentation() ||
+ Ty->isAggregateType();
bool isF64 = Ty->isFloatingType() && getContext().getTypeSize(Ty) == 64;
----------------
efriedma wrote:
> I suspect this code doesn't handle C++ member pointers correctly. But maybe we can leave that for a followup.
>
> Could we simplify this to `bool isInt = !Ty->isFloatingType();`?
Yes, C++ member pointers are broken. I declared a struct animal, tried `typedef void (animal::*noise)(); ... va_arg(ap, noise)`, and it segfaulted. In the disassembly, I saw 2 problems: (1) va_arg was looking at the floating-point registers, and (2) va_arg was not indirecting through a pointer. The caller had passed a pointer to a `noise` in a general-purpose register.
I'm not sure about `bool isInt = !Ty->isFloatingType();`, because I haven't checked whether it would break other types.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90329/new/
https://reviews.llvm.org/D90329
More information about the cfe-commits
mailing list