Skip to content

Commit 4975608

Browse files
committed
fix in opcCastIntToPtr (fixes flyx/NimYAML#92)
1 parent 8c1a686 commit 4975608

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/vm.nim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,11 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
628628
let rb = instr.regB
629629
let typ = regs[ra].node.typ
630630
if typ.kind == tyRef:
631-
regs[ra].node = cast[PNode](regs[rb].intVal)
631+
template fn(val) = regs[ra].node = cast[PNode](val.intVal)
632+
case regs[rb].kind
633+
of rkInt: fn(regs[rb])
634+
of rkNode: fn(regs[rb].node)
635+
else: stackTrace(c, tos, pc, "regs[rb].kind: " & $regs[rb].kind)
632636
else:
633637
let node2 = newNodeIT(nkIntLit, c.debug[pc], typ)
634638
case regs[rb].kind

0 commit comments

Comments
 (0)