parent
343ace8194
commit
b73d097d36
2 changed files with 16 additions and 1 deletions
|
|
@ -2160,7 +2160,7 @@ proc optimizeJumps(c: PCtx; start: int) =
|
||||||
var d = i + c.code[i].jmpDiff
|
var d = i + c.code[i].jmpDiff
|
||||||
for iters in countdown(maxIterations, 0):
|
for iters in countdown(maxIterations, 0):
|
||||||
case c.code[d].opcode
|
case c.code[d].opcode
|
||||||
of opcJmp, opcJmpBack:
|
of opcJmp:
|
||||||
d = d + c.code[d].jmpDiff
|
d = d + c.code[d].jmpDiff
|
||||||
of opcTJmp, opcFJmp:
|
of opcTJmp, opcFJmp:
|
||||||
if c.code[d].regA != reg: break
|
if c.code[d].regA != reg: break
|
||||||
|
|
|
||||||
15
tests/vm/tmaxloopiterations.nim
Normal file
15
tests/vm/tmaxloopiterations.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
discard """
|
||||||
|
errormsg: "interpretation requires too many iterations; if you are sure this is not a bug in your code edit compiler/vmdef.MaxLoopIterations and rebuild the compiler"
|
||||||
|
"""
|
||||||
|
|
||||||
|
# issue #9829
|
||||||
|
|
||||||
|
macro foo(): untyped =
|
||||||
|
let lines = ["123", "5423"]
|
||||||
|
var idx = 0
|
||||||
|
while idx < lines.len():
|
||||||
|
if lines[idx].len() < 1:
|
||||||
|
inc(idx)
|
||||||
|
continue
|
||||||
|
|
||||||
|
foo()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue