fixes #22787; marks var section in the loop as reassign preventing cursor (#22800)

fixes #22787

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
(cherry picked from commit efa64aa49b)
This commit is contained in:
ringabout
2023-10-07 13:43:39 +08:00
committed by narimiran
parent 4f78a4dd3e
commit 08d37c2d7e
2 changed files with 41 additions and 0 deletions

View File

@@ -820,6 +820,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])