diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-03-20 14:35:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-20 14:35:45 +0100 |
commit | 253e1b9e96111acb893411bd12540e46d158f9f6 (patch) | |
tree | 43065dfc19327ce02755d60bf1f89283f8218c23 /compiler/ccgexprs.nim | |
parent | f4dbdd311fbb3dd99dafca2179f17f2747531b4f (diff) | |
download | Nim-253e1b9e96111acb893411bd12540e46d158f9f6.tar.gz |
fixes #13698 (#13706)
Diffstat (limited to 'compiler/ccgexprs.nim')
-rw-r--r-- | compiler/ccgexprs.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 2d1005f5e..9c683a071 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1985,8 +1985,10 @@ proc genRangeChck(p: BProc, n: PNode, d: var TLoc) = discard cgsym(p.module, raiser) # This seems to be bug-compatible with Nim version 1 but what we # should really do here is to check if uint64Value < high(int) + let n0t = n[0].typ let boundaryCast = - if n[0].typ.skipTypes(abstractVarRange).kind in {tyUInt, tyUInt32, tyUInt64}: + if n0t.skipTypes(abstractVarRange).kind in {tyUInt, tyUInt32, tyUInt64} or + (n0t.sym != nil and sfSystemModule in n0t.sym.owner.flags and n0t.sym.name.s == "csize"): "(NI64)" else: "" |