[clang] af6656c - [clang][Interp][NFC] Fix moveArrayTy byte offset

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 7 04:15:59 PST 2024


Author: Timm Bäder
Date: 2024-02-07T13:07:42+01:00
New Revision: af6656c375b8aa9c9156575f7c0ac678a57070d5

URL: https://github.com/llvm/llvm-project/commit/af6656c375b8aa9c9156575f7c0ac678a57070d5
DIFF: https://github.com/llvm/llvm-project/commit/af6656c375b8aa9c9156575f7c0ac678a57070d5.diff

LOG: [clang][Interp][NFC] Fix moveArrayTy byte offset

We need to account for the InitMapPtr here. This is NFC right now since
no test is affected by it.

Added: 
    

Modified: 
    clang/lib/AST/Interp/Descriptor.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Descriptor.cpp b/clang/lib/AST/Interp/Descriptor.cpp
index 5701cf0acf915d..f75a9fc4b46650 100644
--- a/clang/lib/AST/Interp/Descriptor.cpp
+++ b/clang/lib/AST/Interp/Descriptor.cpp
@@ -63,6 +63,9 @@ static void dtorArrayTy(Block *, std::byte *Ptr, const Descriptor *D) {
 template <typename T>
 static void moveArrayTy(Block *, const std::byte *Src, std::byte *Dst,
                         const Descriptor *D) {
+  // FIXME: Need to copy the InitMap?
+  Src += sizeof(InitMapPtr);
+  Dst += sizeof(InitMapPtr);
   for (unsigned I = 0, NE = D->getNumElems(); I < NE; ++I) {
     const auto *SrcPtr = &reinterpret_cast<const T *>(Src)[I];
     auto *DstPtr = &reinterpret_cast<T *>(Dst)[I];


        


More information about the cfe-commits mailing list