Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!apple!portal!cup.portal.com!Bits_of_Magic From: Bits_of_Magic@cup.portal.com Newsgroups: comp.sys.amiga.tech Subject: Re: Bug in Lattice C 5.04 (IBM host) Message-ID: <33572@cup.portal.com> Date: 5 Sep 90 21:35:08 GMT References: <^*}%^D+@masalla.fulcrum.bt.co.uk> <33535@cup.portal.com> Organization: The Portal System (TM) Lines: 44 In my previous post I said: >I found a major bug in Lattice C 5.04 for the IBM host, which is supposed >to be identical to the native version, but I guess not. The bug: > >LONG value; > >switch (value) { > case 0: > DoSomething(); > break; >case 0x100000000 > DoFoo(); > break; >} > >whether value is 0 or 100000000, DoSomething() executes. When I looked at >a disassembly from OMD, it was clear that in the 2nd case, the code was >checking for equality to 0! I am going to call Lattice about this, >and will post further afterwards. Oops! That 2nd case value should be 0x10000000 (instead of a 64 bit #!). Somebody noted that technically a long constant should be followed by an L, but since 32 bits is an integer in this compiler by default, it doesn't require the L. Also, when I found this bug, I was using system defined constants. I have since talked to Lattice and sent them the actual offending code. They were very nice, but will no doubt try to charge $100 for the upgrade with the fixed bug... Interestingly I found 2 more minor bugs today -- they have quit asking me for my serial number because I called so much. The other 2 bugs: 1) The built-in functions abs(), min(), and max() aren't protyped as built- in functions in string.h. You can do it yourself, so it isn't major. 2) The following code generates an argument type incorrect error: void Foo(short); short x,y; Foo(x-y);