Autah-cs.157 net.bugs.v7 utzoo!decvax!duke!chico!zeppo!harpo!utah-cs!lepreau Wed Jan 6 12:25:21 1982 Another C compiler bug While I'm at it, here's another apparent bug in the v7 Ritchie compiler which Spencer Thomas found. We have no fix, does anyone? ------------------ From: thomas Subj: C compiler bug Try this: { char a[2][2]; register int i, j, k; a[i][j] %= k; } and look at the assembly code: ~a=177766 ~i=r4 ~j=r3 ~k=r2 mov r4,r1 // figure out index into array asl r1 add r5,r1 add r3,r1 add $-12,r1 mov r1,-(sp) // push array address mov r2,-(sp) // push divisor movb *2(sp),r1 // get a[i][j] sxt r0 // prepare for divide div (sp)+,r0 // do divide mov r1,*(sp)+ // and save remainder (into a word, not a byte!!) =S ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.