diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-12-18 07:54:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-18 07:54:20 +0100 |
commit | 3f6df5cc3475573807fae9854fe1616535f93412 (patch) | |
tree | a43cf259fda740cda061d96d657271253b32af4a /compiler/ccgexprs.nim | |
parent | f9f55a23bbcb64824954ed83b60816499a7cc338 (diff) | |
download | Nim-3f6df5cc3475573807fae9854fe1616535f93412.tar.gz |
fixes #12899 (#12921)
* fixes #12899 * fixes regression: destroy global variables in reverse declaration order, closureleak test relies on it
Diffstat (limited to 'compiler/ccgexprs.nim')
-rw-r--r-- | compiler/ccgexprs.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 5fa7ac8d7..db8ba79b6 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2031,13 +2031,15 @@ proc genDestroy(p: BProc; n: PNode) = var a: TLoc initLocExpr(p, arg, a) linefmt(p, cpsStmts, "if ($1.p && $1.p->allocator) {$n" & - " $1.p->allocator->dealloc($1.p->allocator, $1.p, $1.p->cap + 1 + sizeof(NI) + sizeof(void*)); }$n", + " $1.p->allocator->dealloc($1.p->allocator, $1.p, $1.p->cap + 1 + sizeof(NI) + sizeof(void*));$n" & + " $1.p = NIM_NIL; }$n", [rdLoc(a)]) of tySequence: var a: TLoc initLocExpr(p, arg, a) linefmt(p, cpsStmts, "if ($1.p && $1.p->allocator) {$n" & - " $1.p->allocator->dealloc($1.p->allocator, $1.p, ($1.p->cap * sizeof($2)) + sizeof(NI) + sizeof(void*)); }$n", + " $1.p->allocator->dealloc($1.p->allocator, $1.p, ($1.p->cap * sizeof($2)) + sizeof(NI) + sizeof(void*));$n" & + " $1.p = NIM_NIL; }$n", [rdLoc(a), getTypeDesc(p.module, t.lastSon)]) else: discard "nothing to do" else: |