summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/vm.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index e16324355..4403a385d 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -231,7 +231,11 @@ proc fastAsgnComplex(x: var TFullReg, y: TFullReg) =
 proc writeField(n: var PNode, x: TFullReg) =
   case x.kind
   of rkNone: discard
-  of rkInt: n.intVal = x.intVal
+  of rkInt:
+    if n.kind == nkNilLit:
+      n[].reset
+      n.kind = nkIntLit # ideally, `nkPtrLit`
+    n.intVal = x.intVal
   of rkFloat: n.floatVal = x.floatVal
   of rkNode: n = copyValue(x.node)
   of rkRegisterAddr: writeField(n, x.regAddr[])