diff options
author | Clyybber <darkmine956@gmail.com> | 2021-04-27 13:03:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-27 13:03:26 +0200 |
commit | b03d6c9b2f9d117ed85d410313b7b39e49a16964 (patch) | |
tree | 1a55284542e5360a6a3658b439b4599d363501bd | |
parent | a236002e54d68a672c720bd9b6d27ea0ba44edb8 (diff) | |
download | Nim-b03d6c9b2f9d117ed85d410313b7b39e49a16964.tar.gz |
Fix #17712 (#17873)
-rw-r--r-- | compiler/dfa.nim | 7 | ||||
-rw-r--r-- | tests/arc/tarcmisc.nim | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/compiler/dfa.nim b/compiler/dfa.nim index c7a9d4694..501d39f45 100644 --- a/compiler/dfa.nim +++ b/compiler/dfa.nim @@ -696,9 +696,10 @@ proc skipTrivials(c: var Con, n: PNode): PNode = proc genUse(c: var Con; orig: PNode) = let n = c.skipTrivials(orig) - if n.kind == nkSym and n.sym.kind in InterestingSyms: - c.code.add Instr(n: orig, kind: use) - elif n.kind in nkCallKinds: + if n.kind == nkSym: + if n.sym.kind in InterestingSyms: + c.code.add Instr(n: orig, kind: use) + else: gen(c, n) proc genDef(c: var Con; orig: PNode) = diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim index 82751f44c..a52538085 100644 --- a/tests/arc/tarcmisc.nim +++ b/tests/arc/tarcmisc.nim @@ -27,6 +27,7 @@ finalizer aaaaa hello ok +true closed destroying variable: 20 destroying variable: 10 @@ -422,3 +423,13 @@ proc test3 = static: test3() # was buggy test3() + +# bug #17712 +proc t17712 = + var ppv = new int + discard @[ppv] + var el: ref int + el = [ppv][0] + echo el != nil + +t17712() |