diff --git a/App/lib/core/Gen/TranslatorGenMixin.vp b/App/lib/core/Gen/TranslatorGenMixin.vp index 0992234..d538e26 100644 --- a/App/lib/core/Gen/TranslatorGenMixin.vp +++ b/App/lib/core/Gen/TranslatorGenMixin.vp @@ -548,6 +548,14 @@ novirtual class TranslatorGenMixin: # resolved struct value in Ptr; pure t.CStruct keeps a value instance. if resolved.kind() == mlirlite.LLVMType.Struct: gv_entry: GenTypes.StructEntry* = self.Gen.StructGen.find_struct_by_type(resolved) + # [TEMP-DIAG] 模块级 struct 全局的类型决策(定位完删除): + # hasnew/hasvtable/isoop 任一为真 ⇒ 全局被包成 Ptr(指针槽), + # 与"局部变量=值本体"不一致 ⇒ `CAM = V3(...)` 被当成把栈地址交给全局。 + gv_hn: int = -1; gv_hv: int = -1; gv_oo: int = -1 + if gv_entry is not None: + gv_hn = gv_entry.HasNew; gv_hv = gv_entry.HasVTable; gv_oo = gv_entry.IsOOP + stdio.printf("[GVAR-DIAG] name=%s hasnew=%d hasvtable=%d isoop=%d\n", + var_name, gv_hn, gv_hv, gv_oo) if gv_entry is not None and (gv_entry.HasNew != 0 or gv_entry.HasVTable != 0 or gv_entry.IsOOP != 0): # Object-class global (object-as-pointer): remember the Struct value type # so a BSS storage global can hold the instance; otherwise @g is NULL.