Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!rutgers!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.bugs.sys5 Subject: incomplete DMD optimizer bug fix Keywords: DMD 5620 C SGS CCS optimizer optim WE32000 3B2 bug fix Message-ID: <8242@brl-smoke.ARPA> Date: 28 Jul 88 19:35:34 GMT Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 31 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 */ ...