[clang] [clang][Interp] Zero-init remaining string literal elements (PR #66862)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 28 23:03:39 PDT 2023
================
@@ -858,8 +858,8 @@ bool ByteCodeExprGen<Emitter>::VisitStringLiteral(const StringLiteral *E) {
// If the initializer string is too long, a diagnostic has already been
// emitted. Read only the array length from the string literal.
- unsigned N =
- std::min(unsigned(CAT->getSize().getZExtValue()), E->getLength());
+ unsigned ArraySize = CAT->getSize().getZExtValue();
----------------
tbaederr wrote:
It's a bit tricky since `StringLiteral::getLength()` returns `unsigned` again, so we can't use the extra bytes anyway and need to cast to `unsigned` for the `std::min()`.
https://github.com/llvm/llvm-project/pull/66862
More information about the cfe-commits
mailing list