Path: utzoo!attcan!uunet!van-bc!root From: bhenning@bhami.vnet.van-bc.UUCP (Bill Henning) Newsgroups: comp.sys.amiga Subject: Lattice C V5.0 Message-ID: <2119@van-bc.UUCP> Date: 8 Jan 89 03:35:38 GMT Sender: root@van-bc.UUCP Lines: 63 I bought Lattice C V5.0 last thursday, and I thought I would relate some of my experiences with it. Overall, I am impressed, and I do like it. However... After painlessly installing the package on my hard drive, I thought I would compile some C programs... this is when the trouble started. One of my previous projects has been a cross-assembler for a microcontroller. Three of the five modules produced a CXERR 26 in line 0 from LC2, which is a 'Temporary save or restore error'. My guess is that the peep hole optimizer is getting confused and removing the store of p's new value back into its variable. After considerable (and judicious) use of '#ifdef FINDBUG...#endif" in a binary search on the smallest of the files I was able to isolate the problem. At the end of this message I've included a small code fragment that illustrates the problem. LC2 cannot handle *p++ where p is declared as an extern pointer to char. This is a serious and terrible bug. C code uses *p++ all over the place. Fortunately, most cases use it within the scope of a single module or function (but my assembler used it across module boundaries, with a .h file declaring it as an extern). I tried -b0, no dice. The only solution I found was to separate it into two statements, and casting the pointer to a long before incrementing it. Before anyone thinks that I'm totally disgruntled with the compiler I should note the following: - the debugger is absolutely fantastic. Lattice deserves a pat on the back for it. - The inclusion of a profiler, lmk, and other utilities is commendable - The manuals are excellent. Nicely layed out, nicely indexed. I am also grateful for the library function compatibility/origin list Great work John Toebes (sp?) and others! Now if only LC2 were fixed... Here is the code illustrating the bug and workaround: extern char ch; extern char far *p; #define BUG void dummy() { #ifdef BUG ch = *p++; #else /* and a temporary work-around ch = *p; (long)p++; #endif } A couple of other minor gripes. When compiling some source with -b0 Blink complained that it could not find cxovf and cxbrk. Fortunately the sources to those functions were included, so it was trivial to compile them and add them to lc.lib. Where is grep.lib? -- ############################################################################## # Amiga // # UUCP: {alberta!ubc-vision,ubc-cs,uunet}!van-bc!bhami!bhenning # # 1000 // # -or- bhenning@bhami.wimsey.bc.ca /* untested at this time */ # # // # -or- bhenning@bhami.van-bc.UUCP /* I prefer UUCP mail */ # # \\ // # BITNET: USERCCPM@SFU.BITNET /* I rarely check for other mail */ # # \X/bhami# ARPA: William_Henning%sfu@um.cc.umich.edu # ##############################################################################