summary refs log tree commit diff stats
path: root/compiler/vm.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r--compiler/vm.nim14
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index 848cbfcf0..05ee3b90e 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -489,17 +489,21 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
       decodeB(rkFloat)
       regs[ra].floatVal = regs[rb].floatVal
     of opcAsgnIntFromFloat32:
-      decodeB(rkFloat)
+      let rb = instr.regB
+      ensureKind(rkInt)
       regs[ra].intVal = cast[int32](float32(regs[rb].floatVal))
     of opcAsgnIntFromFloat64:
-      decodeB(rkFloat)
+      let rb = instr.regB
+      ensureKind(rkInt)
       regs[ra].intVal = cast[int64](regs[rb].floatVal)
     of opcAsgnFloat32FromInt:
-      decodeB(rkInt)
+      let rb = instr.regB
+      ensureKind(rkFloat)
       regs[ra].floatVal = cast[float32](int32(regs[rb].intVal))
     of opcAsgnFloat64FromInt:
-      decodeB(rkInt)
-      regs[ra].floatVal = cast[float64](int64(regs[rb].intVal))
+      let rb = instr.regB
+      ensureKind(rkFloat)
+      regs[ra].floatVal = cast[float64](int64(regs[rb].intVal))      
     of opcAsgnComplex:
       asgnComplex(regs[ra], regs[instr.regB])
     of opcAsgnRef: