fixes #1329
This commit is contained in:
parent
0fc43d3d95
commit
50861792f4
2 changed files with 13 additions and 1 deletions
|
|
@ -1105,6 +1105,8 @@ proc genAddrDeref(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode;
|
||||||
# nkAddr we must not use 'unneededIndirection', but for deref we use it.
|
# nkAddr we must not use 'unneededIndirection', but for deref we use it.
|
||||||
if not isAddr and unneededIndirection(n.sons[0]):
|
if not isAddr and unneededIndirection(n.sons[0]):
|
||||||
gen(c, n.sons[0], dest, newflags)
|
gen(c, n.sons[0], dest, newflags)
|
||||||
|
if gfAddrOf notin flags and fitsRegister(n.typ):
|
||||||
|
c.gABC(n, opcNodeToReg, dest, dest)
|
||||||
elif isAddr and isGlobal(n.sons[0]):
|
elif isAddr and isGlobal(n.sons[0]):
|
||||||
gen(c, n.sons[0], dest, flags+{gfAddrOf})
|
gen(c, n.sons[0], dest, flags+{gfAddrOf})
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ bb
|
||||||
aa
|
aa
|
||||||
bb
|
bb
|
||||||
24
|
24
|
||||||
2147483647 2147483647'''
|
2147483647 2147483647
|
||||||
|
5'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
const s = @[1,2,3]
|
const s = @[1,2,3]
|
||||||
|
|
@ -80,3 +81,12 @@ static:
|
||||||
static:
|
static:
|
||||||
var foo2 = int32.high
|
var foo2 = int32.high
|
||||||
echo foo2, " ", int32.high
|
echo foo2, " ", int32.high
|
||||||
|
|
||||||
|
# bug #1329
|
||||||
|
|
||||||
|
static:
|
||||||
|
var a: ref int
|
||||||
|
new(a)
|
||||||
|
a[] = 5
|
||||||
|
|
||||||
|
echo a[]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue