diff --git a/TransPyV/App/lib/core/Gen/CallGenCtor.vp b/TransPyV/App/lib/core/Gen/CallGenCtor.vp index 24dde76..0b9eada 100644 --- a/TransPyV/App/lib/core/Gen/CallGenCtor.vp +++ b/TransPyV/App/lib/core/Gen/CallGenCtor.vp @@ -140,6 +140,30 @@ class CallGenCtor(CallGenBase.CallGenBase): stdio.printf("[DET] 读取悬空: struct-ctor cargs=%llu block=%llu hdr=0x%llX(0=free 奇数=活跃 其它=非pool块)\n", t.CUInt64T(cargs), blk_c, hdr_c) stdlib.exit(1) + # [DET] 扩展:cargs 列表存活但槽位/数据可能未初始化或悬空(SlotsBugTest + # ASAN 崩溃 node=0xCDCDCDCDCDCDCDCD——cargs.get(ai) 返回 0xCDCD 填充值: + # 列表 __init__ 未执行(__data__/__count__=0xCDCD,MEMBUDDY_FILL_GUARD + # 无条件填充)或 __data__ 悬空。列表头:__data__@0 __count__@8 + # __capacity__@16。命中 0xCDCD 即打印定位并 fail-fast。 + if cargs is not None: + cd_fill: t.CUInt64T = (t.CUInt64T(0xCDCDCDCD) << 32) | t.CUInt64T(0xCDCDCDCD) + lh_c: t.CUInt64T | t.CPtr = (t.CUInt64T | t.CPtr)(t.CVoid(cargs, t.CPtr)) + ldd_c: t.CUInt64T = lh_c[0] + ldc_c: t.CUInt64T = lh_c[1] + ldcap_c: t.CUInt64T = lh_c[2] + if ldd_c == cd_fill or ldc_c == cd_fill: + stdio.printf("[DET] 构造参数列表未初始化: cargs=%llu data=%llu count=%llu cap=%llu can=%llu\n", + t.CUInt64T(cargs), ldd_c, ldc_c, ldcap_c, t.CUInt64T(can)) + stdlib.exit(1) + ai_c: t.CSizeT = 0 + while ai_c < can: + nd_c: ast.AST | t.CPtr = cargs.get(ai_c) + if nd_c is not None and t.CUInt64T(nd_c) == cd_fill: + stdio.printf("[DET] 构造参数槽位悬空: ai=%zu can=%llu node=%llu cargs=%llu data=%llu count=%llu cap=%llu\n", + ai_c, t.CUInt64T(can), t.CUInt64T(nd_c), t.CUInt64T(cargs), + ldd_c, ldc_c, ldcap_c) + stdlib.exit(1) + ai_c += 1 # 创建临时 alloca # 确保跨模块结构体的完整定义在当前模块中可用(供 alloca 分配空间) self.Gen.StructGen.ensure_struct_def_in_module(pool, mod, struct_ty)