From 08282b1355b86902234a510f1faea61621fc4486 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Fri, 16 Mar 2018 15:44:40 +0100 Subject: [PATCH] make 'memset' calls more robust; refs #7341 --- compiler/ccgexprs.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index ba0820e93b..998220469c 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1910,7 +1910,8 @@ proc genSetConstr(p: BProc, e: PNode, d: var TLoc) = if getSize(e.typ) > 8: # big set: useStringh(p.module) - lineF(p, cpsStmts, "memset($1, 0, sizeof($1));$n", [rdLoc(d)]) + lineF(p, cpsStmts, "memset($1, 0, sizeof($2));$n", + [rdLoc(d), getTypeDesc(p.module, e.typ)]) for i in countup(0, sonsLen(e) - 1): if e.sons[i].kind == nkRange: getTemp(p, getSysType(tyInt), idx) # our counter