fixes #25482; ICE leaking temporary 3 slotTempInt (#25483)

fixes #25482

(cherry picked from commit a04f720217)
This commit is contained in:
ringabout
2026-02-05 12:41:54 +08:00
committed by narimiran
parent d48fc130c1
commit 9fa69d222f
2 changed files with 9 additions and 0 deletions

View File

@@ -803,6 +803,8 @@ proc genNarrow(c: PCtx; n: PNode; dest: TDest) =
let first = c.genx(newIntTypeNode(firstOrd(c.config, t), intType))
let last = c.genx(newIntTypeNode(lastOrd(c.config, t), intType))
c.gABC(n, opcNarrowR, dest, first, last)
c.freeTemp(first)
c.freeTemp(last)
proc genNarrowU(c: PCtx; n: PNode; dest: TDest) =
let t = skipTypes(n.typ, abstractVar-{tyTypeDesc})

View File

@@ -821,3 +821,10 @@ proc g1314(_: static bool) = discard
proc g1314(_: int) = discard
proc y1314() = g1314((; let k = 0; k))
y1314()
proc myProc(first: range[0..100]) =
var x = first
while x > 0:
dec(x)
const r = (myProc(3); 1)