Path: utzoo!mnetor!uunet!husc6!m2c!applix!scott From: scott@applix.UUCP (Scott Evernden) Newsgroups: comp.sys.amiga Subject: Re: A bug in Lattice 4.0 Message-ID: <648@applix.UUCP> Date: 8 Feb 88 06:38:13 GMT References: <1070@pembina.UUCP> Sender: news@applix.UUCP Reply-To: scott@applix.UUCP (Scott Evernden) Organization: APPLiX Inc., Westboro MA Lines: 48 In article <1070@pembina.UUCP> andrew@alberta.UUCP (Andrew Folkins) writes: >I don't know about you, but if I compile & run this it's a guaranteed visit >from the guru. > > (... a program which doesn't work under Lattice 4.0 ...) The problem is more simply demonstrated: #include char *foo = "test"; if (strlen(foo) > 0) OMD reveals: 0010 206C 0006-01.2 MOVEA.L 01.00000006(A4),A0 0014 4A18 TST.B (A0)+ 0016 66FC BNE 00000014 0018 5388 SUBQ.L #1,A0 001A 91EC 0006-01.2 SUBA.L 01.00000006(A4),A0 001E 4A88 TST.L A0 ...oops 0020 6F04 BLE 00000026 The in-line strlen() does its work in A registers, but the compiler performs the >0 test via a TST.L Ax, which is an illegal instruction. Sounds like you might want to remove the include. Lattice 4.0 has some other peculiarities. I've seen the compiler generate some useless sequences, like reloading a register with the same value twice, or loading a register and then never using it. Version 4.0 does, however, do a nice job with array indexing, particularly constructs like: array[n] = array[n+1]; handy for those who write such code. It also is much smarter than Manx in the area of small constant multiplies. Something like a = 3*b is handled much more intelligently by Lattice. Also, am I the only one who finds that Lattice consistently generates programs sensitive to phantom ^C aborts? I mean, I execute a Lattice program, and the "User Abort" requester appears. This problem has ALWAYS existed in ALL Lattice versions, and is also evident in some Lattice products, like Lattice Make Utility, for example. -scott