From 911a65198475e53fe6f874564223855174a8df8f Mon Sep 17 00:00:00 2001 From: Miran Date: Tue, 15 Jul 2025 11:06:18 +0200 Subject: [PATCH] Backport #25016 (#25053) This is a `version-2-2` variant of the existing fix. --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> --- compiler/cgen.nim | 22 +++++++++++++++------- tests/global/tglobal3.nim | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 05c63c4680..9de707d5c6 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -2170,6 +2170,20 @@ proc addHcrInitGuards(p: BProc, n: PNode, inInitGuard: var bool) = genStmts(p, n) +proc handleProcGlobals(m: BModule) = + var procGlobals: seq[PNode] = move m.g.graph.procGlobals + + for i in 0..