incomplete DMD optimizer bug fix
Doug Gwyn
gwyn at brl-smoke.ARPA
Fri Jul 29 05:35:34 AEST 1988
I have discovered that the changes to the DMD 2.0 (WE32xxx) C optimizer
that I previously posted were incomplete. In particular, an in-line
function expansion occurring as an argument in another function call
(other than the first argument) would pick up its arguments from the
wrong place. (This is a rather rare situation.)
Some 3B C optimizers might also have this problem.
The reason I missed this earlier is that the way the code dealt with
the ops[MAXOPS] member of a NODE was extremely gross: data of the
wrong type was being forced into this array member as a temporary
variable, rather than just having such a special member of the NODE;
in the func.c source this member was #defined as "opm", but in local.c
it was called ops[MAXOPS] (that's the one I missed when I expanded
the array by 1 to fix a problem in func.c).
Here is the bug fix, which should only be installed if you picked up
my previous changes (which changed the length of ops[] from MAXOPS+1
to MAXOPS+2). In $DMD/sgs/usr/src/cmd/sgs/optim/m32/local.c:
/* @(#) local.c: 1.5 6/26/84 */
...
prinst(p) register NODE *p; { /* print instruction */
...
#ifdef IMPIL
if (p->op == CALL ) {
printf("@ %d %s %s\n",
numauto + ( int ) p->ops[MAXOPS+1], p->op1 + 1, p->op2 ); /* DAG -- was MAXOPS */
p->ops[MAXOPS+1] = NULL; /* DAG -- was MAXOPS */
}
#endif /* IMPIL */
...
More information about the Comp.bugs.sys5
mailing list