llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> Don't try to initialize pointers that can't be initialized --- Full diff: https://github.com/llvm/llvm-project/pull/199400.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+2-1) - (modified) clang/test/AST/ByteCode/builtin-functions.cpp (+7) ``````````diff diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp index 3e9ce902427eb..863a25f519e9b 100644 --- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp +++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp @@ -1019,7 +1019,8 @@ static bool interp__builtin_carryop(InterpState &S, CodePtr OpPC, QualType CarryOutType = Call->getArg(3)->getType()->getPointeeType(); PrimType CarryOutT = *S.getContext().classify(CarryOutType); assignIntegral(S, CarryOutPtr, CarryOutT, CarryOut); - CarryOutPtr.initialize(); + if (CarryOutPtr.canBeInitialized()) + CarryOutPtr.initialize(); assert(Call->getType() == Call->getArg(0)->getType()); pushInteger(S, Result, Call->getType()); diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp index 97fa1760ee167..7b19c3388e7cd 100644 --- a/clang/test/AST/ByteCode/builtin-functions.cpp +++ b/clang/test/AST/ByteCode/builtin-functions.cpp @@ -2048,3 +2048,10 @@ namespace WcslenInvalidArg { static_assert(__builtin_wcslen(L"x") == 1); } + +namespace SubCb { + constexpr unsigned char subcb(unsigned char lhs, unsigned char rhs, unsigned char carry) { + return __builtin_subcb(lhs, rhs, carry, &rhs); + } + static_assert(subcb(10, 15, 1) == 250); +} `````````` </details> https://github.com/llvm/llvm-project/pull/199400 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
