llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/230396.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+2-1) - (modified) clang/test/AST/ByteCode/c.c (+6) ``````````diff diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp index 5f3f59ae242456..4a5c691d390a71 100644 --- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp +++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp @@ -325,7 +325,8 @@ static bool interp__builtin_strcmp(InterpState &S, CodePtr OpPC, QualType ElemTy = getElemType(A); // Different element types shouldn't happen, but with casts they can. - if (!S.getASTContext().hasSameUnqualifiedType(ElemTy, getElemType(B))) + if (!S.getASTContext().hasSameUnqualifiedType(ElemTy, getElemType(B)) || + !S.getContext().canClassify(ElemTy)) return false; PrimType ElemT = *S.getContext().classify(ElemTy); diff --git a/clang/test/AST/ByteCode/c.c b/clang/test/AST/ByteCode/c.c index 7dd3f667559ed9..e431691ed190d8 100644 --- a/clang/test/AST/ByteCode/c.c +++ b/clang/test/AST/ByteCode/c.c @@ -486,3 +486,9 @@ Parse sqlite3Prepare_sParse; void sqlite3Prepare(void) { memset( ((char *)&sqlite3Prepare_sParse) + sizeof(int), 0, sizeof(int)); } + +int strcmp(const char *, const char *); +const union u { + char c[2]; +} str[] = {"", ""}; +const int strcmpFoo = strcmp((const char *)str, (const char *)str); // all-error {{not a compile-time constant}} `````````` </details> https://github.com/llvm/llvm-project/pull/230396 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
