Path: utzoo!attcan!uunet!dalcs!dalcsug!dalegass
From: dalegass@dalcsug.UUCP (Dale Gass)
Newsgroups: comp.sys.ibm.pc
Subject: Re: RFC: DOS/LatticeC defects?
Message-ID: <471@dalcsug.UUCP>
Date: 11 May 88 13:16:10 GMT
References: <4330078@hpindda.HP.COM>
Reply-To: dalegass@dalcsug.UUCP (Dale Gass)
Organization: Dalhousie University, Halifax, N.S., Canada
Lines: 21

In article <4330078@hpindda.HP.COM> mintz@hpindda.HP.COM (Ken Mintz) writes:
>While doing my 1st DOS program in many years, I may have stumbled onto 2
>defects.

We've discovered a code generation bug in lattice C (ver 3.0)...  When
initializing elements in a structure entry as follows:

data[index].item1 = t1 * 100.0;
data[index].item2 = t2 * 100.0;

Lattice tries to be smart, and stashes index away in [bp+0] and [bp+2]
temporarily, but when it goes to pick it up to use it for the second
line, it picks it up in *reverse* order (so if the index was 0x100, it
becomes 0x1000000, even though index is only an int [it is stashed and
handled as a long for a long multiplication for the indexing into
array of structure]).

Kinda scary working with a compiler that pulls something like
this; makes you wonder what else it's doing.

-dalegass@dalcsug.uucp