================
@@ -367,10 +367,18 @@ static bool interp__builtin_strlen(InterpState &S,
CodePtr OpPC,
unsigned ElemSize = StrPtr.getFieldDesc()->getElemSize();
if (ID == Builtin::BI__builtin_wcslen || ID == Builtin::BIwcslen) {
- [[maybe_unused]] const ASTContext &AC = S.getASTContext();
- assert(ElemSize == AC.getTypeSizeInChars(AC.getWCharType()).getQuantity());
+ const ASTContext &AC = S.getASTContext();
+ unsigned WCharSize =
AC.getTypeSizeInChars(AC.getWCharType()).getQuantity();
+ if (ElemSize != WCharSize) {
+ if (S.diagnosing()) {
+ // a dedicated diagnostic
+ diagnoseNonConstexprBuiltin(S, OpPC, ID);
+ }
+ return false;
+ }
----------------
tbaederr wrote:
```suggestion
if (ElemSize != WCharSize)
return false;
```
https://github.com/llvm/llvm-project/pull/177891
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits