diff options
author | Michał Zieliński <michal@zielinscy.org.pl> | 2019-02-06 10:13:44 +0100 |
---|---|---|
committer | Michał Zieliński <michal@zielinscy.org.pl> | 2019-02-06 10:13:44 +0100 |
commit | 580f62220c5384726fdcd526afeaf5e4954225e9 (patch) | |
tree | 0c20c5af1268d23dfac5a020946731e7bc6e4502 /compiler/ccgexprs.nim | |
parent | 2e880c726b0072bec93e897e5caef8f5bbe3d6b6 (diff) | |
download | Nim-580f62220c5384726fdcd526afeaf5e4954225e9.tar.gz |
Fixes #10568: Fix null pointer dereference in address computation.
According to https://hownot2code.com/2016/08/18/null-pointer-dereferencing-causes-undefined-behavior/ this was an undefined behaviour.
Diffstat (limited to 'compiler/ccgexprs.nim')
-rw-r--r-- | compiler/ccgexprs.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 5bcbcda1c..fb2fd89a3 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1123,7 +1123,7 @@ proc genSeqElemAppend(p: BProc, e: PNode, d: var TLoc) = # seq = (typeof seq) incrSeq(&seq->Sup, sizeof(x)); # seq->data[seq->len-1] = x; let seqAppendPattern = if not p.module.compileToCpp: - "($2) #incrSeqV3(&($1)->Sup, $3)" + "($2) #incrSeqV3((TGenericSeq*)($1), $3)" else: "($2) #incrSeqV3($1, $3)" var a, b, dest, tmpL, call: TLoc |