Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!pyramid!amiga!dale From: dale@amiga.UUCP (Dale Luck) Newsgroups: net.micro.amiga Subject: Re: Re: LATTICE BUG (3.03) -unsigned? short optimization bug Message-ID: <1582@amiga.amiga.UUCP> Date: Wed, 15-Oct-86 17:00:43 EDT Article-I.D.: amiga.1582 Posted: Wed Oct 15 17:00:43 1986 Date-Received: Thu, 16-Oct-86 18:57:46 EDT References: <8610111659.AA11477@cory.Berkeley.EDU> Reply-To: dale@tooter.UUCP (Dale Luck) Organization: Commodore-Amiga Inc., 983 University Ave #D, Los Gatos CA 95030 Lines: 23 In article <8610111659.AA11477@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes: >>Actually, I wonder about this. Shouldn't the expected result be zero? >> >>The partial sum (y+z) should be done completely in ushort, giving >> 0xFFFF + 0x0002 = 0x0001 (retaining only the lower 16 bits) >> >>so that the quotient (1/16) [done in integer math] should be zero. >>I don't see any reason why the code generated for "x=..." and "xx=..." >>should differ. >> >>Am I missing something here? > > All integral arguments, baring floating expressions, for arithmatic >operations are supposed to be extended to INT if they are <= INT. On Lattice, >this is 32bits. > > -Matt > However this is pretty poor coding practice. If you expected the results to overflow a 16bit the programmer should have made allowances for this. It's those kind of problems that give compiler writers a severe headache when trying to do some intelligeant optimizing code generation. Dale Luck