mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
(cherry picked from commit 38b3590e40)
This commit is contained in:
@@ -948,9 +948,13 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
|
||||
c.genAddSubInt(n, dest, opcAddInt)
|
||||
of mInc, mDec:
|
||||
unused(c, n, dest)
|
||||
let opc = if m == mInc: opcAddInt else: opcSubInt
|
||||
let isUnsigned = n.sons[1].typ.skipTypes(abstractVarRange).kind in {tyUInt..tyUInt64}
|
||||
let opc = if not isUnsigned:
|
||||
if m == mInc: opcAddInt else: opcSubInt
|
||||
else:
|
||||
if m == mInc: opcAddu else: opcSubu
|
||||
let d = c.genx(n.sons[1])
|
||||
if n.sons[2].isInt8Lit:
|
||||
if n.sons[2].isInt8Lit and not isUnsigned:
|
||||
c.gABI(n, succ(opc), d, d, n.sons[2].intVal)
|
||||
else:
|
||||
let tmp = c.genx(n.sons[2])
|
||||
|
||||
@@ -200,3 +200,17 @@ const
|
||||
vmCrash = oh_no()
|
||||
|
||||
debugEcho vmCrash
|
||||
|
||||
|
||||
# bug #12310
|
||||
|
||||
proc someTransform(s: var array[8, uint64]) =
|
||||
var s1 = 5982491417506315008'u64
|
||||
s[1] += s1
|
||||
|
||||
static:
|
||||
var state: array[8, uint64]
|
||||
state[1] = 7105036623409894663'u64
|
||||
someTransform(state)
|
||||
|
||||
doAssert state[1] == 13087528040916209671'u64
|
||||
|
||||
Reference in New Issue
Block a user