diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -709,7 +709,8 @@ "Unexpected CoerceToType seen in arginfo in generic VAArg emitter!"); Address Temp = CGF.CreateMemTemp(Ty, "varet"); - Val = CGF.Builder.CreateVAArg(VAListAddr.getPointer(), CGF.ConvertType(Ty)); + Val = CGF.Builder.CreateVAArg(VAListAddr.getPointer(), + CGF.ConvertTypeForMem(Ty)); CGF.Builder.CreateStore(Val, Temp); return Temp; } diff --git a/clang/test/CodeGen/arm64-arguments.c b/clang/test/CodeGen/arm64-arguments.c --- a/clang/test/CodeGen/arm64-arguments.c +++ b/clang/test/CodeGen/arm64-arguments.c @@ -196,6 +196,16 @@ __builtin_va_end(ap); return ll; } +_Bool t3(int i, ...) { + // CHECK: t3 + __builtin_va_list ap; + __builtin_va_start(ap, i); + // CHECK: %0 = va_arg {{.*}}* %ap, i8 + // CHECK-NEXT: store i8 %0, i8* %varet, align 1 + _Bool b = __builtin_va_arg(ap, _Bool); + __builtin_va_end(ap); + return b; +} #include