From owner-freebsd-hackers Fri Jun 14 14:59:16 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA22601 for hackers-outgoing; Fri, 14 Jun 1996 14:59:16 -0700 (PDT) Received: (from julian@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA22588 for hackers; Fri, 14 Jun 1996 14:59:09 -0700 (PDT) Date: Fri, 14 Jun 1996 14:59:09 -0700 (PDT) From: Julian Elischer Message-Id: <199606142159.OAA22588@freefall.freebsd.org> To: hackers Subject: unexpected gcc behaviour in freebsd? Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk The following program doesn't do what I expected.. is this right? I spent an hour chasing a problem in a driver because of this... > cat x.c #include unsigned short a,b; main() { unsigned short a,b; a = 0; b = ~a; if ( b == ~a) { printf("expected result\n"); } else { printf("unexpected result\n"); } exit(0); } > cc x.c > ./a.out unexpected result > the operation ~a seems to promote to LONG which causes odd behaviour.. certainly seems broken to me.. anyone have 2.7.2 to check this on.. gcc on freefall seems to do the unexpected thing.. julian .