llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> The getType() call might fail. We can't pull the isReadable() check up though because that creates different diagnostic output compared to the current interpreter. Fixes #<!-- -->172202 --- Full diff: https://github.com/llvm/llvm-project/pull/174192.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+3) - (modified) clang/test/AST/ByteCode/builtins.c (+1) ``````````diff diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp index 065870c5c0ab5..b4acb786fa90c 100644 --- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp +++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp @@ -2078,6 +2078,9 @@ static bool interp__builtin_memchr(InterpState &S, CodePtr OpPC, return false; } + if (!Ptr.isBlockPointer()) + return false; + QualType ElemTy = Ptr.getFieldDesc()->isArray() ? Ptr.getFieldDesc()->getElemQualType() : Ptr.getFieldDesc()->getType(); diff --git a/clang/test/AST/ByteCode/builtins.c b/clang/test/AST/ByteCode/builtins.c index 5be5455ab8813..684db52296fc2 100644 --- a/clang/test/AST/ByteCode/builtins.c +++ b/clang/test/AST/ByteCode/builtins.c @@ -18,3 +18,4 @@ int structStrlen(void) { } void f() { __builtin_memcpy(f, f, 1); } +void f2() { __builtin_memchr(f2, 0, 1); } `````````` </details> https://github.com/llvm/llvm-project/pull/174192 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
