Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!sdrc!scjones From: scjones@sdrc.UUCP (Larry Jones) Newsgroups: comp.unix.microport Subject: 386/3.0e bug in cc Keywords: unsigned in constant expressions Message-ID: <524@sdrc.UUCP> Date: 2 Feb 89 22:28:05 GMT Organization: Structural Dynamics Research Corp., Cincinnati Lines: 19 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. ---- 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."