This commit is contained in:
Andreas Rumpf 2020-03-10 00:52:46 +01:00 • committed by GitHub
commit 090ba1e3a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 4 deletions

View file

@ -591,7 +591,8 @@ proc p(n: PNode; c: var Con; mode: ProcessMode): PNode =
# move the variable declaration to the top of the frame:
c.addTopVar v
# make sure it's destroyed at the end of the proc:
if not isUnpackedTuple(v):
if not isUnpackedTuple(v) and sfThread notin v.sym.flags:
# do not destroy thread vars for now at all for consistency.
c.destroys.add genDestroy(c, v)
elif c.inLoop > 0:
# unpacked tuple needs reset at every loop iteration