diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2019-01-22 07:36:40 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-01-22 07:36:40 +0100 |
commit | 44c04b35717336595dad03ac532ee9e141a0e374 (patch) | |
tree | ddadd6cfc49d1d5bef8b5b77508613efeb9c04a9 /compiler | |
parent | 3ea099bc7f75d35ee127932208d9d012b57f11f8 (diff) | |
download | Nim-44c04b35717336595dad03ac532ee9e141a0e374.tar.gz |
Object downconversion in VM should not copy (#10378)
Hopefully the type-check phase already rejected all the invalid conversions by the time we execute the VM bytecode. Problem reported by chrisheller on the Nim Forum
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/vm.nim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim index 10d38fe77..131501380 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -399,6 +399,11 @@ proc opConv(c: PCtx; dest: var TFullReg, src: TFullReg, desttyp, srctyp: PType): dest.floatVal = toBiggestFloat(src.intVal) else: dest.floatVal = src.floatVal + of tyObject: + if srctyp.skipTypes(abstractRange).kind != tyObject: + internalError(c.config, "invalid object-to-object conversion") + # A object-to-object conversion is essentially a no-op + moveConst(dest, src) else: asgnComplex(dest, src) |