summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-11-25 11:48:10 -0800
committerGitHub <noreply@github.com>2020-11-25 20:48:10 +0100
commit3e7077ac7d2f4867ecabff09b730b6bc9356979d (patch)
tree1f2703555c8926fe37b1e1557f000181b0c3d27e /compiler
parent7848da7abe683f98019f54f9b99ce531c99e7eaf (diff)
downloadNim-3e7077ac7d2f4867ecabff09b730b6bc9356979d.tar.gz
fix #14339, #13511, #14420: fixes limited VM support for addr (#16002)
* fix #14339: fixes limited VM support for addr

* strengthen test

* reference bug #16003

* also fixes #13511

* also fixes #14420
Diffstat (limited to 'compiler')
-rw-r--r--compiler/vm.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index a6478f3f0..17bbe65fc 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -746,10 +746,13 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
       regs[ra].regAddr = addr(regs[rb])
     of opcAddrNode:
       decodeB(rkNodeAddr)
-      if regs[rb].kind == rkNode:
+      case regs[rb].kind
+      of rkNode:
         regs[ra].nodeAddr = addr(regs[rb].node)
+      of rkNodeAddr: # bug #14339
+        regs[ra].nodeAddr = regs[rb].nodeAddr
       else:
-        stackTrace(c, tos, pc, "limited VM support for 'addr'")
+        stackTrace(c, tos, pc, "limited VM support for 'addr', got kind: " & $regs[rb].kind)
     of opcLdDeref:
       # a = b[]
       let ra = instr.regA