From 39ddf11ddcc3e7ac991e30407db77d2b22a490cb Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Thu, 13 Aug 2026 06:59:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(stmt):=20=E7=A7=BB=E9=99=A4=20raise=20?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E4=B8=AD=E6=97=A0=E6=95=88=E7=9A=84=20LLVMTy?= =?UTF-8?q?pe.Double=20=E6=A8=A1=E5=BC=8F=EF=BC=8C=E4=BF=AE=E5=A4=8D=20llc?= =?UTF-8?q?=20=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LLVMType 是 REnum,Float(Bits) 变体已覆盖 double(Bits=64),无独立 Double 变体。case LLVMType.Double(_db) 被 TPV match 按未知变体处理 (匹配一切),导致 Int(32) 等整数返回类型的 raise StopIteration 落入 Double 分支生成 ConstFloat(0.0) 位模式常量(0x0000000000000000), ret i32 0x0000000000000000 被 llc 判为 "floating point constant invalid for type"。删除该分支后整数返回走 case _ 的 ConstZero。 --- App/lib/core/Gen/StmtGenMixin.vp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/App/lib/core/Gen/StmtGenMixin.vp b/App/lib/core/Gen/StmtGenMixin.vp index 4798499..4b79c34 100644 --- a/App/lib/core/Gen/StmtGenMixin.vp +++ b/App/lib/core/Gen/StmtGenMixin.vp @@ -187,10 +187,6 @@ class StmtGenMixin: zero_f: llvmlite.Value | t.CPtr = llvmlite.ConstFloat(pool, ret_ty, 0.0) if zero_f is not None: llvmlite.build_ret(builder, zero_f) - case llvmlite.LLVMType.Double(_db): - zero_f2: llvmlite.Value | t.CPtr = llvmlite.ConstFloat(pool, ret_ty, 0.0) - if zero_f2 is not None: - llvmlite.build_ret(builder, zero_f2) case _: zero_v: llvmlite.Value | t.CPtr = llvmlite.ConstZero(pool, ret_ty) if zero_v is not None: