make the build more robust
This commit is contained in:
parent
ed79201d0b
commit
4948cf3b4c
2 changed files with 9 additions and 3 deletions
|
|
@ -909,6 +909,11 @@ proc genSeqElem(p: BProc, n, x, y: PNode, d: var TLoc) =
|
||||||
if ty.kind in {tyRef, tyPtr}:
|
if ty.kind in {tyRef, tyPtr}:
|
||||||
ty = skipTypes(ty.lastSon, abstractVarRange) # emit range check:
|
ty = skipTypes(ty.lastSon, abstractVarRange) # emit range check:
|
||||||
if optBoundsCheck in p.options:
|
if optBoundsCheck in p.options:
|
||||||
|
if ty.kind == tyString and not defined(nimNoZeroTerminator):
|
||||||
|
linefmt(p, cpsStmts,
|
||||||
|
"if (!$2 || (NU)($1) > (NU)($2->$3)) #raiseIndexError();$n",
|
||||||
|
rdLoc(b), rdLoc(a), lenField(p))
|
||||||
|
else:
|
||||||
linefmt(p, cpsStmts,
|
linefmt(p, cpsStmts,
|
||||||
"if (!$2 || (NU)($1) >= (NU)($2->$3)) #raiseIndexError();$n",
|
"if (!$2 || (NU)($1) >= (NU)($2->$3)) #raiseIndexError();$n",
|
||||||
rdLoc(b), rdLoc(a), lenField(p))
|
rdLoc(b), rdLoc(a), lenField(p))
|
||||||
|
|
|
||||||
|
|
@ -115,3 +115,4 @@ proc initDefines*() =
|
||||||
defineSymbol("nimSymKind")
|
defineSymbol("nimSymKind")
|
||||||
defineSymbol("nimVmEqIdent")
|
defineSymbol("nimVmEqIdent")
|
||||||
defineSymbol("nimNoNil")
|
defineSymbol("nimNoNil")
|
||||||
|
defineSymbol("nimNoZeroTerminator")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue