Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site teltone.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!tektronix!uw-beaver!tikal!teltone!joe From: joe@teltone.UUCP (Joe) Newsgroups: net.lang.c Subject: VAX bug: unsigned short comparision with integer constant Message-ID: <762@teltone.UUCP> Date: Mon, 5-Nov-84 20:24:14 EST Article-I.D.: teltone.762 Posted: Mon Nov 5 20:24:14 1984 Date-Received: Thu, 8-Nov-84 00:21:18 EST Organization: Teltone Corp., Kirkland, WA Lines: 23 The following program demonstrates an interesting bug on the VAX (4.1 and 4.2 BSD UNIX). The comparison of unsigned short x = 0xffff and the integer constant 0xffffffff should fail as type conversion should convert x to 0x0000ffff and the integer constant should remain 0xffffffff. The enclosed piece of code shows that this is not the case. The code does compile correctly on a Pyramid. ===================================================================== /* Demo of unsigned short comparision with integer constant */ #include main() { unsigned short x; int y; x = 0xffff; if (x == 0xffffffff) printf("x == 0xffffffff, x = %x, 0xffffffff = %x\n", x, 0xffffffff); else printf("x != 0xffffffff, x = %x, 0xffffffff = %x\n", x, 0xffffffff); }