parent
ec20fd3544
commit
38b3590e40
2 changed files with 20 additions and 2 deletions
|
|
@ -948,9 +948,13 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
|
||||||
c.genAddSubInt(n, dest, opcAddInt)
|
c.genAddSubInt(n, dest, opcAddInt)
|
||||||
of mInc, mDec:
|
of mInc, mDec:
|
||||||
unused(c, n, dest)
|
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])
|
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)
|
c.gABI(n, succ(opc), d, d, n.sons[2].intVal)
|
||||||
else:
|
else:
|
||||||
let tmp = c.genx(n.sons[2])
|
let tmp = c.genx(n.sons[2])
|
||||||
|
|
|
||||||
|
|
@ -200,3 +200,17 @@ const
|
||||||
vmCrash = oh_no()
|
vmCrash = oh_no()
|
||||||
|
|
||||||
debugEcho vmCrash
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue