From d67ae4afa688f02059b83e59a7f19a8a8030272b Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Tue, 4 May 2021 07:03:00 +0200 Subject: [PATCH] IC: codegen: fix (#17931) --- compiler/ccgexprs.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index a42c30aae3..b5ad24cc18 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(