From c685aa11b5012c00f032c3f03c7589513270fd77 Mon Sep 17 00:00:00 2001 From: em Date: Tue, 9 Sep 1986 13:10:15 +0000 Subject: [PATCH] set limit on optimization passes to prevent loop in optimizer in case of bad table. --- util/opt/peephole.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/opt/peephole.c b/util/opt/peephole.c index 1a52beea7..3b013cb44 100644 --- a/util/opt/peephole.c +++ b/util/opt/peephole.c @@ -609,7 +609,9 @@ basicblock(alpp) line_p *alpp; { register byte *bp; int i; short index; + int npasses; + npasses = 0; do { /* make pass over basicblock */ lpp = alpp; madeopt = FALSE; while ((*lpp) != (line_p) 0 && ((*lpp)->l_instr&BMASK) != op_lab) { @@ -648,5 +650,6 @@ basicblock(alpp) line_p *alpp; { } lpp = next; } - } while(madeopt); /* as long as there is progress */ + } while(madeopt && ++npasses<5000); /* as long as there is progress */ + assert(!madeopt); } -- 2.34.1