fixes a critical xlen codegen bug

This commit is contained in:
Araq 2015-11-03 13:20:23 +01:00
commit 1dda0e4b84

View file

@ -1713,7 +1713,7 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
genArrayLen(p, e, d, op) genArrayLen(p, e, d, op)
of mXLenStr, mXLenSeq: of mXLenStr, mXLenSeq:
if not p.module.compileToCpp: if not p.module.compileToCpp:
unaryExpr(p, e, d, "($1->Sup.len-1)") unaryExpr(p, e, d, "($1->Sup.len)")
else: else:
unaryExpr(p, e, d, "$1->len") unaryExpr(p, e, d, "$1->len")
of mGCref: unaryStmt(p, e, d, "#nimGCref($1);$n") of mGCref: unaryStmt(p, e, d, "#nimGCref($1);$n")