llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> We can't save the result in a non-block pointer. Fixes https://github.com/llvm/llvm-project/issues/165076 --- Full diff: https://github.com/llvm/llvm-project/pull/165221.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+1-1) - (modified) clang/test/AST/ByteCode/builtin-functions.cpp (+5) ``````````diff diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp index d0b97a18e1815..aec150a9f0781 100644 --- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp +++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp @@ -749,7 +749,7 @@ static bool interp__builtin_overflowop(InterpState &S, CodePtr OpPC, const CallExpr *Call, unsigned BuiltinOp) { const Pointer &ResultPtr = S.Stk.pop<Pointer>(); - if (ResultPtr.isDummy()) + if (ResultPtr.isDummy() || !ResultPtr.isBlockPointer()) return false; PrimType RHST = *S.getContext().classify(Call->getArg(1)->getType()); diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp index 0b7d51be8d824..2c47e2971f4a1 100644 --- a/clang/test/AST/ByteCode/builtin-functions.cpp +++ b/clang/test/AST/ByteCode/builtin-functions.cpp @@ -1853,3 +1853,8 @@ namespace InitParam { } #endif + +namespace SAddOverflowInt { + int a; + void foo(void) { a *= __builtin_sadd_overflow(1, 2, 0); } +} `````````` </details> https://github.com/llvm/llvm-project/pull/165221 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
