From 1a2ee566e333b265b5276d69ccfc1508ba56a783 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Fri, 27 Jun 2025 16:17:16 +0800 Subject: [PATCH] fixes #24997; {.global.} variable in recursive function (#25016) fixes #24997 handles functions in recursive order (cherry picked from commit 3ce38f2959d020996f4cf64e211f91732927f789) --- 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..ed4e77647d 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..