Hello tech list,

clang for 32-bit powerpc has a bug that breaks va_arg(3) when the
argument type is an object or block in Objective-C.  This breaks
GNUstep on macppc.  This clang diff fixes GNUstep.  Objective-C uses
pointers to represent objects and blocks, so this diff tells clang's
va_arg to handle things with pointer representations as pointers.

Anthony Richardby found and reported the bug,
https://bugs.llvm.org/show_bug.cgi?id=47921

I posted this diff at https://reviews.llvm.org/D90329 but upstream
llvm might do something else.  I used a clang with this diff to
rebuild src and xenocara on macppc.

ok to commit?  --George

Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
RCS file: /cvs/src/gnu/llvm/clang/lib/CodeGen/TargetInfo.cpp,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 TargetInfo.cpp
--- clang/lib/CodeGen/TargetInfo.cpp    9 Aug 2020 15:51:11 -0000       1.1.1.2
+++ clang/lib/CodeGen/TargetInfo.cpp    28 Oct 2020 23:43:54 -0000
@@ -4248,8 +4248,8 @@ Address PPC32_SVR4_ABIInfo::EmitVAArg(Co
   // };
 
   bool isI64 = Ty->isIntegerType() && getContext().getTypeSize(Ty) == 64;
-  bool isInt =
-      Ty->isIntegerType() || Ty->isPointerType() || Ty->isAggregateType();
+  bool isInt = Ty->isIntegerType() || Ty->hasPointerRepresentation() ||
+               Ty->isAggregateType();
   bool isF64 = Ty->isFloatingType() && getContext().getTypeSize(Ty) == 64;
 
   // All aggregates are passed indirectly?  That doesn't seem consistent

Reply via email to