🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6051

Re: Signed or unsigned address comparisons?

#6051
From: James Carlson
Date: Wed, 11 Dec 1996 00:00
24 lines
1833 bytes

In article <c7574ef08b6629a6c3f2218773ac27bf@wretched.mailer.com>, "Richard Kiessig" <rick@kiessig.com> writes:
|> GCC seems to generate address comparisons in RTL as signed compares (i.e.
|> "GT" instead of "GTU").  Is there a reason for this?  Shouldn't address
|> compares be unsigned?  It probably doesn't matter on most machines, but it
|> does on the one I'm working on.

According to section 6.3.9 of the ANSI standard, the only requirement
on the relational operators when used with addresses is that they
operate correctly within the same object.  So as long as the compiler
never allocates an object which spans the magic + to - boundary and
malloc() never returns a block which spans that boundary, then signed
and unsigned are equivalent, and any code which doesn't behave correctly
with this definition isn't ANSI code.

Of course, unsigned is a much more natural address comparison mode for
virtually all programmers, so I can't explain why gcc does this.  Looks
like a buglet to me.

-- 
James Carlson <carlson@xylogics.com>            Tel:  +1 617 272 8140
Annex Interface Development / Xylogics, Inc.          +1 800 225 3317
53 Third Avenue / Burlington MA  01803-4491     Fax:  +1 617 272 2618
Technical Details
Message-ID: <58n6df$rgb@atlas.xylogics.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <c7574ef08b6629a6c3f2218773ac27bf@wretched.mailer.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,76e11d8cd428fc2b
X-Google-Attributes: gid113d02,public
From: carlson@xylogics.com (James Carlson)
Subject: Re: Signed or unsigned address comparisons?
Date: 1996/12/11
Message-ID: <58n6df$rgb@atlas.xylogics.com>
X-Deja-AN: 203589955
sender: bug-gcc-request@prep.ai.mit.edu
references: <c7574ef08b6629a6c3f2218773ac27bf@wretched.mailer.com>
organization: Xylogics Incorporated
x-gateway: relay3.UU.NET from bug-gcc to gnu.gcc.bug; Wed, 11 Dec 1996 15:51:14 EST
reply-to: carlson@xylogics.com
newsgroups: gnu.gcc.bug