From f69fb1e7ad896cef1649f33386ab0a2f6b66033d Mon Sep 17 00:00:00 2001 From: Donn Seeley Date: Sun, 27 Apr 1986 11:18:12 -0800 Subject: [PATCH] Fixed a bug that caused char *cp to be incremented by 4 in 'if (*cp++ & 01)' because of an oversight in jbc => jlbc optimization in bitopt(). Made long *lp, 'if (*lp++ & 01)', eligible instead; suggested by Chris Torek. SCCS-vsn: old/pcc/c2.vax/c21.c 4.19 --- usr/src/old/pcc/c2.vax/c21.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr/src/old/pcc/c2.vax/c21.c b/usr/src/old/pcc/c2.vax/c21.c index 5a380064cb..b5d31ad411 100644 --- a/usr/src/old/pcc/c2.vax/c21.c +++ b/usr/src/old/pcc/c2.vax/c21.c @@ -1,5 +1,5 @@ #ifndef lint -static char sccsid[] = "@(#)c21.c 4.18 %G%"; +static char sccsid[] = "@(#)c21.c 4.19 %G%"; #endif /* char C21[] = {"@(#)c21.c 1.83 80/10/16 21:18:22 JFR"}; /* sccs ident */ @@ -747,8 +747,9 @@ bitopt(p) register struct node *p; { register char *cp1,*cp2; int b; cp1=regs[RT1]; cp2=regs[RT2]; if (*cp1++!='$' || !okio(cp2) || p->forw->op!=CBR || p->forw->subop&-2 || - 0>(b=ispow2(getnum(cp1))) || - p->subop!=BYTE && (source(cp2) || indexa(cp2))) return; + 0>(b=ispow2(getnum(cp1)))) return; + if (p->subop!=BYTE && !(b==0 && p->subop==LONG) && + (source(cp2) || indexa(cp2))) return; if (b>=bitsize[p->subop]) {/* you dummy! */ if (source(cp2)) {/* side effect: auto increment or decrement */ p->pop=0; @@ -763,7 +764,8 @@ bitopt(p) register struct node *p; { if (cp1=p->forw->code) {/* destination is not an internal label */ cp2=regs[RT3]; while (*cp2++= *cp1++); } - if (b==0 && (p->subop==LONG || !indexa(regs[RT2]))) {/* JLB optimization, ala BLISS */ + if (b==0 && (p->subop==LONG || !(source(regs[RT2]) || indexa(regs[RT2])))) { + /* JLB optimization, ala BLISS */ cp2=regs[RT1]; cp1=regs[RT2]; while (*cp2++= *cp1++); cp2=regs[RT2]; cp1=regs[RT3]; while (*cp2++= *cp1++); *(regs[RT3])=0; p->forw->subop += JLBC-JBC; -- 2.20.1