From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Lynn Winebarger Newsgroups: gmane.lisp.guile.devel Subject: Re: SCM_POSFIXABLE(-1) fails with MSVC++ 6.0 Date: Sat, 24 Aug 2002 10:57:52 -0500 Sender: guile-devel-admin@gnu.org Message-ID: <02082410575214.19624@locke.free-expression.org> References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1030204857 10712 127.0.0.1 (24 Aug 2002 16:00:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 24 Aug 2002 16:00:57 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17idLM-0002mf-00 for ; Sat, 24 Aug 2002 18:00:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17idMZ-0006R6-00; Sat, 24 Aug 2002 12:02:11 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17idMM-0006Pp-00 for guile-devel@gnu.org; Sat, 24 Aug 2002 12:01:58 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17idMK-0006Pa-00 for guile-devel@gnu.org; Sat, 24 Aug 2002 12:01:58 -0400 Original-Received: from plounts.uits.indiana.edu ([129.79.1.73]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17idMK-0006PV-00 for guile-devel@gnu.org; Sat, 24 Aug 2002 12:01:56 -0400 Original-Received: from stjoseph.uits.indiana.edu (stjoseph.uits.indiana.edu [129.79.1.78]) by plounts.uits.indiana.edu (8.12.1/8.12.1/IUPO) with ESMTP id g7OG1sqj010466 for ; Sat, 24 Aug 2002 11:01:54 -0500 (EST) Original-Received: from locke.free-expression.org (dial-123-2.dial.indiana.edu [156.56.123.2]) by stjoseph.uits.indiana.edu (8.12.1/8.12.1/IUPO) with SMTP id g7OG1q6I024652 for ; Sat, 24 Aug 2002 11:01:52 -0500 (EST) Original-To: guile-devel@gnu.org X-Mailer: KMail [version 1.2] In-Reply-To: Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:1148 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1148 On Saturday 24 August 2002 02:42, Dirk Herrmann wrote: > > I am not sure I understand the problem here: is the failure of testing > -1 <= sizeof(long) a compiler bug, or is the strange behaviour defined > in the C language? It is mandated by K&R 2nd edition (Section A6). When an expression has and unsigned long and a signed long, the signed long is promoted to unsigned, but without any change to the actual bit representation. Thus -1 is 2^32-1, which is clearly bigger than sizeof(long). If you really want to compare to -1, cast the unsigned to signed (since we know it'll fit in this case, and if promoted, will still give the correct result (that is, if compared to an unsigned quantity, it will get recast to unsigned, only this time the cast will get it right)). So gcc's probably wrong on this. Apparently their optimization pass does its constant folding with a more accurate notion of integers than the machine code has. It's possible this has been changed, but I would find it hard to believe as it would change the semantics of so many programs. Lynn _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel