Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!natinst!bigtex!pmafire!dave From: dave@pmafire.UUCP (Dave Remien) Newsgroups: comp.unix.microport Subject: Re: 386/3.0e bug in cc Summary: Yup - It's a bug in pcc Keywords: unsigned in constant expressions Message-ID: <585@pmafire.UUCP> Date: 3 Feb 89 18:37:43 GMT References: <524@sdrc.UUCP> Reply-To: dave@pmafire.UUCP (Dave Remien) Followup-To: comp.unix.microport Organization: WINCO, INEL, Idaho Lines: 33 In article <524@sdrc.UUCP> scjones@sdrc.UUCP (Larry Jones) writes: :>I just ran across a bug in the c compiler on 386/3.0e. If you :>compare an unsigned constant expression to a signed constant :>expression, the result of the comparison is computed at compile :>time using a SIGNED comparison rather than an UNSIGNED comparison. :> :>For example: :> :> ~(unsigned)0 < 1000 :> :>is evaluated as 1 when it should clearly be 0. If you stick in a :>variable so that the compiler has to generate code, the code gets :>the right answer. It's there, all right, using the cc (AT&T portable C compiler also used in Bell Tech's System V/386), but not in either the Greenhills nor GNU C compilers. Seems like a good reason to go GNU, yes? Actually, the Greenhills C is pretty good as well; I just don't really like reading the advertising for every module that gets compiled. :> :>---- :>Larry Jones UUCP: uunet!sdrc!scjones :>SDRC scjones@sdrc.UU.NET :>2000 Eastman Dr. BIX: ltl :>Milford, OH 45150 AT&T: (513) 576-2070 :>"When all else fails, read the directions." -- Dave Remien - WINCO Computer Engineering Group (only somewhat confused, now) Work - 208-526-3523 Home - 208-524-1906 UUCP Path: ...!bigtex!pmafire!dave "How can you be in two places at once, when you're not anywhere at all..."