From a34ce2714a11595808cd8421636a89f44c1feb7b Mon Sep 17 00:00:00 2001 From: Araq <rumpf_a@web.de> Date: Wed, 10 Apr 2019 13:53:47 +0200 Subject: newruntime: fixes another bug --- lib/core/seqs.nim | 2 +- lib/core/strs.nim | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/core') diff --git a/lib/core/seqs.nim b/lib/core/seqs.nim index 7eb2afe17..a79f0c2f5 100644 --- a/lib/core/seqs.nim +++ b/lib/core/seqs.nim @@ -104,7 +104,7 @@ proc newSeqPayload(cap, elemSize: int): pointer {.compilerRtl, raises: [].} = proc prepareSeqAdd(len: int; p: pointer; addlen, elemSize: int): pointer {. compilerRtl, noSideEffect, raises: [].} = {.noSideEffect.}: - if len+addlen <= len: + if addlen <= 0: result = p elif p == nil: result = newSeqPayload(len+addlen, elemSize) diff --git a/lib/core/strs.nim b/lib/core/strs.nim index 767e897c8..49dc59508 100644 --- a/lib/core/strs.nim +++ b/lib/core/strs.nim @@ -171,8 +171,7 @@ proc setLengthStrV2(s: var NimStringV2, newLen: int) {.compilerRtl.} = s.len = newLen proc nimAsgnStrV2(a: var NimStringV2, b: NimStringV2) {.compilerRtl.} = - # self assignment is fine! - #if unlikely(a.p == b.p): return + if a.p == b.p: return if isLiteral(b): # we can shallow copy literals: frees(a) -- cgit 1.4.1-2-gfad0