[clang] [clang][Interp] Zero-init remaining string literal elements (PR #66862)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 28 10:45:46 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();
----------------
shafik wrote:

So `getZExtValue()` returns `uint64_t` yet we are using `unsigned`. I know this is already an existing problem that we make varying assumptions in different places but I am wondering what the long-term plan is for this this. Forgive me if I have asked this question in another context and I just forgot.

https://github.com/llvm/llvm-project/pull/66862


More information about the cfe-commits mailing list