summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/cgen.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 6a5d890a8..5de2481ed 100755
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -405,6 +405,9 @@ proc assignGlobalVar(p: BProc, s: PSym) =
     if sfRegister in s.flags: app(p.module.s[cfsVars], " register")
     if sfVolatile in s.flags: app(p.module.s[cfsVars], " volatile")
     appf(p.module.s[cfsVars], " $1;$n", [s.loc.r])
+  if p.withinLoop > 0:
+    # fixes tests/run/tzeroarray:
+    initLocalVar(p, s, false)
   if p.module.module.options * {optStackTrace, optEndb} ==
                                {optStackTrace, optEndb}: 
     appcg(p.module, p.module.s[cfsDebugInit],