llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

That should never happen.

---
Full diff: https://github.com/llvm/llvm-project/pull/243392.diff


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+2-2) 
- (modified) clang/lib/AST/ByteCode/Pointer.h (+1-5) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp 
b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index e35e198da0dcb..ff7a8a7c09827 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -7098,8 +7098,8 @@ static void zeroAll(PtrView Dest) {
   if (Desc->isPrimitiveArray()) {
     for (unsigned I = 0, N = Desc->getNumElems(); I != N; ++I) {
       TYPE_SWITCH(Desc->getPrimType(), {
-        Dest.deref<T>().~T();
-        new (&Dest.deref<T>()) T();
+        Dest.elem<T>(I).~T();
+        new (&Dest.elem<T>(I)) T();
       });
     }
     return;
diff --git a/clang/lib/AST/ByteCode/Pointer.h b/clang/lib/AST/ByteCode/Pointer.h
index f1dcc5637455d..fa864bb91d850 100644
--- a/clang/lib/AST/ByteCode/Pointer.h
+++ b/clang/lib/AST/ByteCode/Pointer.h
@@ -246,11 +246,7 @@ struct PtrView {
   template <typename T> T &deref() const {
     assert(isLive() && "Invalid pointer");
     assert(Pointee);
-
-    if (isArrayRoot())
-      return *reinterpret_cast<T *>(Pointee->data() + Base +
-                                    sizeof(InitMapPtr));
-
+    assert(!isArrayRoot());
     return *reinterpret_cast<T *>(Pointee->data() + Offset);
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/243392
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to