🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #5183

Re: Bug in Lattice C 5.04 (IBM host)

#5183
From: Brian Sullivan
Date: Wed, 05 Sep 1990 22:07
31 lines
1577 bytes
> 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.
> 
> Nicky Robinson
> <bits_of_magic@cup.portal.com>

   What do you really expect the compiler to do?  It should give you an
error message or warning  about "hex constant too large", but otherwise 
the compiler is simply doing what it should.  You hex constant 0x100000000, 
is too large to fit into a 32-bit storage container.  I suspect that the 
compiler parser is scaning the constant digit by digit, multiplying by 16 
each time and adding the new digit value.  

   You program is clearly in error, since hex constants can be at most 8 hex
digits long.  
Technical Details
Message-ID: <9890005@hpcljms.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpda!hpcuhb!hpcllla!hpclisp!hpcljms!brians
References: <33535@cup.portal.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpda!hpcuhb!hpcllla!hpclisp!hpcljms!brians
From: brians@hpcljms.HP.COM (Brian Sullivan)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Bug in Lattice C 5.04 (IBM host)
Message-ID: <9890005@hpcljms.HP.COM>
Date: 5 Sep 90 22:07:03 GMT
References: <33535@cup.portal.com>
Organization: Hewlett-Packard Calif. Language Lab
Lines: 31