From 69026d6c17285046230d5e046eab4d0e5adcdb40 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 25 Oct 1991 14:27:59 +0000 Subject: [PATCH] Bug fix: used field of freed struct --- util/ego/cj/cj.c | 20 ++++++-------------- util/ego/cj/proto.make | 2 +- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/util/ego/cj/cj.c b/util/ego/cj/cj.c index 9191daf4f..cbecd362c 100644 --- a/util/ego/cj/cj.c +++ b/util/ego/cj/cj.c @@ -55,6 +55,8 @@ STATIC int Scj; /* number of optimizations found */ +STATIC showinstr(); + #define DLINK(l1,l2) l1->l_next=l2; l2->l_prev=l1 @@ -200,9 +202,12 @@ STATIC jump_cross(l1,l2,b1,b2) DLINK(l,l1); } b->b_start = l; - for (l = l2; INSTR(l) != op_bra; l = l->l_next) { + for (l = l2; INSTR(l) != op_bra;) { + line_p next = l->l_next; + assert (l != (line_p) 0); rm_line(l,b2); + l = next; } INSTRLAB(l) = INSTRLAB(b->b_start); } @@ -355,16 +360,3 @@ STATIC showinstr(lnp) line_p lnp; { } printf("\n"); } /* showinstr */ - - -STATIC print_list(list,b1,b2,p) - line_p list; - bblock_p b1,b2; - proc_p p; -{ - line_p l; - printf("block %d and %d of proc %d:\n",b1->b_id,b2->b_id,p->p_id); - for (l = list; l != 0; l = l->l_next) { - showinstr(l); - } -} diff --git a/util/ego/cj/proto.make b/util/ego/cj/proto.make index e9d4171fd..4d115d71b 100644 --- a/util/ego/cj/proto.make +++ b/util/ego/cj/proto.make @@ -37,7 +37,7 @@ clean: rm -f *.$(SUF) cj Out out nohup.out lint: - $(LINT) $(LINTFLAGS) $(CFILES) + $(LINT) $(LINTFLAGS) $(CFILES) $(EMLIB)/ego/$(LINTPREF)share.$(LINTSUF) $(EMLIB)/$(LINTPREF)em_data.$(LINTSUF) pr: @pr $(PRFILES)