summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-05-04 07:03:00 +0200
committerGitHub <noreply@github.com>2021-05-04 07:03:00 +0200
commitd67ae4afa688f02059b83e59a7f19a8a8030272b (patch)
tree9376fcb2b46c562ad9324180d4421608d6d0a3fe
parent01f316cf1f34fc23cd2a7df7ee84fe85215e70d6 (diff)
downloadNim-d67ae4afa688f02059b83e59a7f19a8a8030272b.tar.gz
IC: codegen: fix (#17931)
-rw-r--r--compiler/ccgexprs.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim
index a42c30aae..b5ad24cc1 100644
--- a/compiler/ccgexprs.nim
+++ b/compiler/ccgexprs.nim
@@ -2640,7 +2640,9 @@ proc genConstSetup(p: BProc; sym: PSym): bool =
   result = lfNoDecl notin sym.loc.flags
 
 proc genConstHeader(m, q: BModule; p: BProc, sym: PSym) =
-  assert(sym.loc.r != nil)
+  if sym.loc.r == nil:
+    if not genConstSetup(p, sym): return
+  assert(sym.loc.r != nil, $sym.name.s & $sym.itemId)
   if m.hcrOn:
     m.s[cfsVars].addf("static $1* $2;$n", [getTypeDesc(m, sym.loc.t, skVar), sym.loc.r]);
     m.initProc.procSec(cpsLocals).addf(