From 832b0a570690d8649443eed966cdb4b6e72fb72c Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Fri, 16 Oct 2026 00:12:06 +0800 Subject: [PATCH] =?UTF-8?q?chore(diag):=20[VAR-DIAG]=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=20alloca=20=E5=9C=B0=E5=9D=80=E6=89=93=E5=8D=B0=20-=20?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=20pos/npos=20=E5=85=B1=E4=BA=AB=E5=AD=98?= =?UTF-8?q?=E5=82=A8(=E5=80=BC=E8=AF=AD=E4=B9=89=E8=A2=AB=E7=A0=B4?= =?UTF-8?q?=E5=9D=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/lib/core/Gen/AssignGenMixin.vp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/App/lib/core/Gen/AssignGenMixin.vp b/App/lib/core/Gen/AssignGenMixin.vp index 5acb69e..6db9e18 100644 --- a/App/lib/core/Gen/AssignGenMixin.vp +++ b/App/lib/core/Gen/AssignGenMixin.vp @@ -2254,8 +2254,10 @@ novirtual class AssignGenMixin: # Ensure the full cross-module struct definition is available (for alloca) self.Gen.StructGen.ensure_struct_def_in_module(pool, trans.Module, var_ty) - # [TEMP-DIAG] 变量声明的槽类型文本(定位完删除): - # class 标注若被解析成 `ptr`,槽就是"指针"而非值本位(`CAM: V3` / `col: V3` 现场)。 + alloca: mlirlite.Value* = self.Gen.VarGen._alloca_at_entry(builder, var_ty) + # [TEMP-DIAG] 变量声明的槽类型 + **alloca 地址**(定位完删除): + # `npos = pos + Δ` 之后 pos.y 变化 ⇒ 若 pos/npos 的 slot 地址相同,说明两个变量 + # 共用了同一块存储(槽复用/RVO 回填错槽),值语义被破坏。 vtb: str = "?" bt0: str = pool.alloc_tagged(512, memhub.DETSITE_ASSIGNGEN_578) if bt0 is not None: @@ -2268,8 +2270,8 @@ novirtual class AssignGenMixin: fn0: str = None if trans._cur_func is not None: fn0 = mlirlite.function_get_name(trans._cur_func) if fn0 is None: fn0 = "?" - stdio.printf("[VAR-DIAG] fn=%s name=%s vptr=%d var_ty=%s\n", fn0, nm0, vptr0, vtb) - alloca: mlirlite.Value* = self.Gen.VarGen._alloca_at_entry(builder, var_ty) + stdio.printf("[VAR-DIAG] fn=%s name=%s vptr=%d slot=0x%x var_ty=%s\n", + fn0, nm0, vptr0, uint64(alloca) if alloca is not None else uint64(0), vtb) if alloca is not None: if self.Gen.VarGen.define_var(trans.SymTab, nm.id, alloca) == 0: # Store the annotation's class name; pass pool so generic Subscript yields the mangled name