[clang] [clang][bytecode] Add an assertion in initScope() op (PR #189972)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 1 08:01:21 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

I've run into a problem in a branch lately that would've benefitted from this assertion.

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


1 Files Affected:

- (modified) clang/lib/AST/ByteCode/InterpFrame.cpp (+1) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/InterpFrame.cpp b/clang/lib/AST/ByteCode/InterpFrame.cpp
index 0d429e773f88f..1c7d65dc28e02 100644
--- a/clang/lib/AST/ByteCode/InterpFrame.cpp
+++ b/clang/lib/AST/ByteCode/InterpFrame.cpp
@@ -97,6 +97,7 @@ void InterpFrame::initScope(unsigned Idx) {
     return;
 
   for (auto &Local : Func->getScope(Idx).locals()) {
+    assert(!localBlock(Local.Offset)->isInitialized());
     localBlock(Local.Offset)->invokeCtor();
   }
 }

``````````

</details>


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


More information about the cfe-commits mailing list