Author: Timm Bäder Date: 2024-06-24T16:17:03+02:00 New Revision: ae1c564d1522f1202d05b698dce8d9c8ca46667c
URL: https://github.com/llvm/llvm-project/commit/ae1c564d1522f1202d05b698dce8d9c8ca46667c DIFF: https://github.com/llvm/llvm-project/commit/ae1c564d1522f1202d05b698dce8d9c8ca46667c.diff LOG: [clang][Interp] Cast dummy pointers to other pointer type if necessary Added: Modified: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/test/Sema/ptrauth.c Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 3c96059375360..69661a590b9c2 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -3574,8 +3574,14 @@ bool ByteCodeExprGen<Emitter>::VisitBuiltinCallExpr(const CallExpr *E) { Builtin == Builtin::BI__builtin___NSStringMakeConstantString || Builtin == Builtin::BI__builtin_ptrauth_sign_constant || Builtin == Builtin::BI__builtin_function_start) { - if (std::optional<unsigned> GlobalOffset = P.createGlobal(E)) - return this->emitGetPtrGlobal(*GlobalOffset, E); + if (std::optional<unsigned> GlobalOffset = P.createGlobal(E)) { + if (!this->emitGetPtrGlobal(*GlobalOffset, E)) + return false; + + if (PrimType PT = classifyPrim(E); PT != PT_Ptr && isPtrType(PT)) + return this->emitDecayPtr(PT_Ptr, PT, E); + return true; + } return false; } diff --git a/clang/test/Sema/ptrauth.c b/clang/test/Sema/ptrauth.c index cd069881793c5..fc1ae954fa36b 100644 --- a/clang/test/Sema/ptrauth.c +++ b/clang/test/Sema/ptrauth.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics %s +// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics %s -fexperimental-new-constant-interpreter #if __has_feature(ptrauth_intrinsics) #warning Pointer authentication enabled! _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits