fixes a critical xlen codegen bug

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

View File

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