diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-01-30 18:43:53 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-01-30 18:43:53 +0100 |
commit | 3e33084da7ed51818335ba785c2de837a4d653db (patch) | |
tree | 43046ce02697c7e9de375c331711be06313d76e3 /compiler | |
parent | 83e0e32f934a47eeab661288cb3d63a7258ec06f (diff) | |
download | Nim-3e33084da7ed51818335ba785c2de837a4d653db.tar.gz |
fixes a critical codegenbug
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgexprs.nim | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 3607f347e..fcc36e4fd 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1056,12 +1056,15 @@ proc genSeqElemAppend(p: BProc, e: PNode, d: var TLoc) = var a, b, dest: TLoc initLocExpr(p, e.sons[1], a) initLocExpr(p, e.sons[2], b) + let bt = skipTypes(e.sons[2].typ, abstractVar) lineCg(p, cpsStmts, seqAppendPattern, [ rdLoc(a), getTypeDesc(p.module, skipTypes(e.sons[1].typ, abstractVar)), - getTypeDesc(p.module, skipTypes(e.sons[2].typ, abstractVar))]) + getTypeDesc(p.module, bt)]) keepAlive(p, a) - initLoc(dest, locExpr, b.t, OnHeap) + #if bt != b.t: + # echo "YES ", e.info, " new: ", typeToString(bt), " old: ", typeToString(b.t) + initLoc(dest, locExpr, bt, OnHeap) dest.r = rfmt(nil, "$1->data[$1->$2]", rdLoc(a), lenField(p)) genAssignment(p, dest, b, {needToCopy, afDestIsNil}) lineCg(p, cpsStmts, "++$1->$2;$n", rdLoc(a), lenField(p)) |