fixes #14159 [backport:1.2]
This commit is contained in:
parent
4301a7bdf0
commit
87ac28d19a
2 changed files with 36 additions and 1 deletions
|
|
@ -639,8 +639,10 @@ proc isAnalysableFieldAccess*(orig: PNode; owner: PSym): bool =
|
||||||
of nkHiddenDeref, nkDerefExpr:
|
of nkHiddenDeref, nkDerefExpr:
|
||||||
# We "own" sinkparam[].loc but not ourVar[].location as it is a nasty
|
# We "own" sinkparam[].loc but not ourVar[].location as it is a nasty
|
||||||
# pointer indirection.
|
# pointer indirection.
|
||||||
|
# bug #14159, we cannot reason about sinkParam[].location as it can
|
||||||
|
# still be shared for tyRef.
|
||||||
n = n[0]
|
n = n[0]
|
||||||
return n.kind == nkSym and n.sym.owner == owner and (isSinkParam(n.sym) or
|
return n.kind == nkSym and n.sym.owner == owner and (
|
||||||
n.sym.typ.skipTypes(abstractInst-{tyOwned}).kind in {tyOwned})
|
n.sym.typ.skipTypes(abstractInst-{tyOwned}).kind in {tyOwned})
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ discard """
|
||||||
output: '''BEGIN
|
output: '''BEGIN
|
||||||
END
|
END
|
||||||
END 2
|
END 2
|
||||||
|
cpu.nes false
|
||||||
|
cpu step nes is nil? - false
|
||||||
0'''
|
0'''
|
||||||
cmd: '''nim c --gc:orc $file'''
|
cmd: '''nim c --gc:orc $file'''
|
||||||
"""
|
"""
|
||||||
|
|
@ -59,7 +61,38 @@ proc main =
|
||||||
c.run
|
c.run
|
||||||
echo "END 2"
|
echo "END 2"
|
||||||
|
|
||||||
|
# bug #14159
|
||||||
|
type
|
||||||
|
NES = ref object
|
||||||
|
cpu: CPU
|
||||||
|
apu: APU
|
||||||
|
|
||||||
|
CPU = ref object
|
||||||
|
nes: NES
|
||||||
|
|
||||||
|
APU = object
|
||||||
|
nes: NES
|
||||||
|
cpu: CPU
|
||||||
|
|
||||||
|
proc initAPU(nes: sink NES): APU {.nosinks.} =
|
||||||
|
result.nes = nes
|
||||||
|
result.cpu = nes.cpu
|
||||||
|
|
||||||
|
proc step(cpu: CPU): int =
|
||||||
|
echo "cpu.nes ", cpu.isNil
|
||||||
|
echo "cpu step nes is nil? - ", cpu.nes.isNil()
|
||||||
|
|
||||||
|
proc newNES(): NES =
|
||||||
|
new result
|
||||||
|
result.cpu = CPU(nes: result)
|
||||||
|
result.apu = initAPU(result)
|
||||||
|
|
||||||
|
proc bug14159 =
|
||||||
|
var nesConsole = newNES()
|
||||||
|
discard nesConsole.cpu.step()
|
||||||
|
|
||||||
let mem = getOccupiedMem()
|
let mem = getOccupiedMem()
|
||||||
main()
|
main()
|
||||||
|
bug14159()
|
||||||
GC_fullCollect()
|
GC_fullCollect()
|
||||||
echo getOccupiedMem() - mem
|
echo getOccupiedMem() - mem
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue