* fixes #13722

* better fix
This commit is contained in:
Andreas Rumpf 2020-03-23 15:47:10 +01:00 • committed by GitHub
commit fc5dd11b3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 12 deletions

View file

@ -616,7 +616,7 @@ proc pVarScoped(v: PNode; c: var Con; ri, res: PNode) =
# unpacked tuple needs reset at every loop iteration
res.add newTree(nkFastAsgn, v, genDefaultCall(v.typ, c, v.info))
elif {sfGlobal, sfThread} * v.sym.flags == {sfGlobal}:
c.graph.globalDestructors.add genDestroy(c, v)
c.graph.globalDestructors.add genDestroy(c, v)
else:
# We always translate 'var v = f()' into bitcopies. If 'v' is in a loop,
# the destruction at the loop end will free the resources. Other assignments