Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!genrad!panda!talcott!harvard!seismo!hao!noao!terak!mot!anasazi!rick From: rick@anasazi.UUCP (Rick Coupland) Newsgroups: net.micro.amiga Subject: Re: Problem with Amigaterm.c and Lattice 3.03 Message-ID: <506@anasazi.UUCP> Date: Mon, 27-Jan-86 16:31:46 EST Article-I.D.: anasazi.506 Posted: Mon Jan 27 16:31:46 1986 Date-Received: Sat, 1-Feb-86 04:21:39 EST Reply-To: rick@anasazi.UUCP (Rick Coupland) Organization: Anasazi, Phoenix Az. Lines: 44 Keywords: Lattice Amigaterm I also had problems compiling Amigaterm using version 3.03 of the Lattice C compiler. I was finaly able to track this problem down to a bug in the compiler which was incorrectly compiling experssions of the form "&array[var+con]". I have notified Lattice of this bug and presumable it will be fixed in the next release. I was able to get around the problem in Amigaterm by changing the routines "InitFileItems" and "InitRSItems" to use pointer variables rather than arrays with a variable subscript. If anyone would like a copy of my modified versions of these routines, reply by mail and I will send it. The following is a copy of the test program which I sent to Lattice which illustrates the bug which was causing the problems with Amigaterm: ------------------------------------------------------------------------------- /* Test program to demonstrate a bug in version 3.03 of the amiga Lattice C compiler */ /* Compile this program and look at the object file with OMD. The compiler generates code which calculates an incorrect value for the pointer which is being assigned to xl[n].ptr */ struct xyz { struct xyz *ptr; short value; }; struct xyz xl[5]; main() { short n; for (n=0; n<4; n++) { /* The following line compiles incorrectly */ xl[n].ptr = &xl[n+1]; xl[n].value = 5*n; } printf("%x, %x, %x, %x\n",&xl[1],&xl[2],&xl[3],&xl[4]); for (n=0; n<4; n++) printf("xl[%d].ptr = %x\n",n,xl[n].ptr); }