From a2e1c651fcb755ff37eb23ab5bf442fa07934626 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Fri, 9 Oct 2026 11:01:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(gen):=20=E5=8F=98=E9=87=8F=E8=A1=A8=20Freed?= =?UTF-8?q?=20=E4=B8=8D=E5=86=8D=E9=80=90=E4=B8=AA=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=86=99=EF=BC=8C=E7=BB=9F=E4=B8=80=E4=BE=9D=E8=B5=96=20init?= =?UTF-8?q?=5Fvars=20=E7=9A=84=E6=95=B4=E5=9D=97=E6=B8=85=E9=9B=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 崩点已定位在普通函数形参注册段(auto_addr 之后、_SlifeReset 之前)。add_var 里对刚加过字段的 VarEntry 末端逐个写 entry.Freed 疑似越界/踩偏移;init_vars 本就 memset 整块,去掉冗余写入。 --- App/lib/core/Gen/VarGenMixin.vp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/App/lib/core/Gen/VarGenMixin.vp b/App/lib/core/Gen/VarGenMixin.vp index 0b2596e..0402c6f 100644 --- a/App/lib/core/Gen/VarGenMixin.vp +++ b/App/lib/core/Gen/VarGenMixin.vp @@ -305,8 +305,8 @@ novirtual class VarGenMixin: entry.IsConst = 0 # 生命期标签显式初始化:未登记 = LIFE_UNKNOWN(保守放行)。 entry.Life = GenTypes.LIFE_UNKNOWN - # P2 willFree:新变量未失效。显式清零,避免复用槽位残留上一变量的失效态。 - entry.Freed = 0 + # P2 willFree 的 entry.Freed **不在这里写**:init_vars 已对整块 memset 清零(见 init_vars), + # 逐个字段写末端偏移在"结构体刚加字段"时容易踩到;统一依赖整块清零。 # [S3 dual write] Value-type Spec (alloca.Ty is Ptr(value type), so take its pointee) entry.Spec = self._spec_of_var_alloca(alloca) return 0