diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-10-07 13:43:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-07 07:43:39 +0200 |
commit | efa64aa49b11e93461626e84b9f67b6185f26e1f (patch) | |
tree | 89ebc44e3dc1eb09947580ce5901f2aa65443c79 /compiler | |
parent | f111009e5dadceeab2fb076c968f8e18a5e495f8 (diff) | |
download | Nim-efa64aa49b11e93461626e84b9f67b6185f26e1f.tar.gz |
fixes #22787; marks `var section` in the loop as reassign preventing cursor (#22800)
fixes #22787 --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/varpartitions.nim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/varpartitions.nim b/compiler/varpartitions.nim index 74bf63da8..957497bb6 100644 --- a/compiler/varpartitions.nim +++ b/compiler/varpartitions.nim @@ -823,6 +823,10 @@ proc computeLiveRanges(c: var Partitions; n: PNode) = registerVariable(c, child[i]) #deps(c, child[i], last) + if c.inLoop > 0 and child[0].kind == nkSym: # bug #22787 + let vid = variableId(c, child[0].sym) + if child[^1].kind != nkEmpty: + markAsReassigned(c, vid) of nkAsgn, nkFastAsgn, nkSinkAsgn: computeLiveRanges(c, n[0]) computeLiveRanges(c, n[1]) |