diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-01-23 10:49:56 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-01-23 11:22:19 +0100 |
commit | 93068f1ba69de7ccf0ed9b1b30a55abde88d5d66 (patch) | |
tree | d5c68355a432b872aa67e4917b9617faac1696bc | |
parent | 65dda793359da08d04cf22c91c157985d9b8e152 (diff) | |
download | Nim-93068f1ba69de7ccf0ed9b1b30a55abde88d5d66.tar.gz |
avoid some compiler crashes in debug mode
-rw-r--r-- | compiler/semtypinst.nim | 4 | ||||
-rw-r--r-- | compiler/vm.nim | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 4f1f420a8..75dffb67f 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -314,7 +314,9 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType = if bodyIsNew and newbody.typeInst == nil: #doassert newbody.typeInst == nil newbody.typeInst = result - if tfRefsAnonObj in newbody.flags: + if tfRefsAnonObj in newbody.flags and newbody.kind != tyGenericInst: + # can come here for tyGenericInst too, see tests/metatype/ttypeor.nim + # need to look into this issue later assert newbody.kind in {tyRef, tyPtr} assert newbody.lastSon.typeInst == nil newbody.lastSon.typeInst = result diff --git a/compiler/vm.nim b/compiler/vm.nim index c8a854247..17bd2d85b 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -244,7 +244,10 @@ proc pushSafePoint(f: PStackFrame; pc: int) = if f.safePoints.isNil: f.safePoints = @[] f.safePoints.add(pc) -proc popSafePoint(f: PStackFrame) = discard f.safePoints.pop() +proc popSafePoint(f: PStackFrame) = + # XXX this needs a proper fix! + if f.safePoints.len > 0: + discard f.safePoints.pop() proc cleanUpOnException(c: PCtx; tos: PStackFrame): tuple[pc: int, f: PStackFrame] = @@ -405,7 +408,7 @@ proc recSetFlagIsRef(arg: PNode) = arg.flags.incl(nfIsRef) for i in 0 ..< arg.safeLen: arg.sons[i].recSetFlagIsRef - + proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg = var pc = start var tos = tos |