From 01ac83b971fd13ed0efc8b5de176c596b59f5c58 Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 8 Jan 1987 14:10:02 +0000 Subject: [PATCH] fix to prevent loop resulting in stack overflow --- mach/proto/ncg/reg.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mach/proto/ncg/reg.c b/mach/proto/ncg/reg.c index fc3546c6c..9f645fbec 100644 --- a/mach/proto/ncg/reg.c +++ b/mach/proto/ncg/reg.c @@ -71,6 +71,12 @@ getrefcount(regno) { erasereg(regno) { register struct reginfo *rp; + register int i; + + rp = &machregs[regno]; + rp->r_contents.t_token = 0; + for (i=0;ir_contents.t_att[i].aw = 0; #if MAXMEMBERS==0 awayreg(regno); @@ -86,11 +92,6 @@ awayreg(regno) { register tkdef_p tdp; register i; - rp = &machregs[regno]; - rp->r_contents.t_token = 0; - for (i=0;ir_contents.t_att[i].aw = 0; - /* Now erase recursively all registers containing * something using this one */ @@ -98,7 +99,7 @@ awayreg(regno) { if (rp->r_contents.t_token == -1) { if (rp->r_contents.t_att[0].ar == regno) erasereg(rp-machregs); - } else { + } else if (rp->r_contents.t_token > 0) { tdp= & tokens[rp->r_contents.t_token]; for (i=0;it_type[i] == EV_REG && -- 2.34.1