parent
f4dbdd311f
commit
253e1b9e96
2 changed files with 9 additions and 2 deletions
|
|
@ -1985,8 +1985,10 @@ proc genRangeChck(p: BProc, n: PNode, d: var TLoc) =
|
||||||
discard cgsym(p.module, raiser)
|
discard cgsym(p.module, raiser)
|
||||||
# This seems to be bug-compatible with Nim version 1 but what we
|
# This seems to be bug-compatible with Nim version 1 but what we
|
||||||
# should really do here is to check if uint64Value < high(int)
|
# should really do here is to check if uint64Value < high(int)
|
||||||
|
let n0t = n[0].typ
|
||||||
let boundaryCast =
|
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)"
|
"(NI64)"
|
||||||
else:
|
else:
|
||||||
""
|
""
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''uint'''
|
output: '''uint
|
||||||
|
1'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Tests unsigned literals and implicit conversion between uints and ints
|
# Tests unsigned literals and implicit conversion between uints and ints
|
||||||
|
|
@ -60,3 +61,7 @@ discard $x0
|
||||||
|
|
||||||
const x1 = cast[uint](-1)
|
const x1 = cast[uint](-1)
|
||||||
discard $(x1,)
|
discard $(x1,)
|
||||||
|
|
||||||
|
# bug 13698
|
||||||
|
let n: csize = 1
|
||||||
|
echo n.int32
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue