summary refs log tree commit diff stats
path: root/compiler/ccgexprs.nim
diff options
context:
space:
mode:
authortersec <tersec@users.noreply.github.com>2023-03-29 10:00:00 +0000
committerGitHub <noreply@github.com>2023-03-29 12:00:00 +0200
commit51ced0d68477e4d2ae5fa8183579922ec47cd318 (patch)
tree5d2523a846df9d95a8277cdc5cb0026f6d89e58f /compiler/ccgexprs.nim
parentc06623bf8ccfccf4788e9f4d2f044ab1bde6fe46 (diff)
downloadNim-51ced0d68477e4d2ae5fa8183579922ec47cd318.tar.gz
remove `seq[T]` `setLen` undefined behavior (#21582)
remove seq[T] setLen UB
Diffstat (limited to 'compiler/ccgexprs.nim')
-rw-r--r--compiler/ccgexprs.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim
index a64a42219..80f9fb563 100644
--- a/compiler/ccgexprs.nim
+++ b/compiler/ccgexprs.nim
@@ -1947,7 +1947,7 @@ proc genSetLengthSeq(p: BProc, e: PNode, d: var TLoc) =
 
   initLoc(call, locCall, e, OnHeap)
   if not p.module.compileToCpp:
-    const setLenPattern = "($3) #setLengthSeqV2(&($1)->Sup, $4, $2)"
+    const setLenPattern = "($3) #setLengthSeqV2(($1)?&($1)->Sup:NIM_NIL, $4, $2)"
     call.r = ropecg(p.module, setLenPattern, [
       rdLoc(a), rdLoc(b), getTypeDesc(p.module, t),
       genTypeInfoV1(p.module, t.skipTypes(abstractInst), e.info)])