public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: dewar@gnat.com
To: egcs@tantalophile.demon.co.uk, schwab@suse.de
Cc: aoliva@redhat.com, denisc@overta.ru, dkorn@pixelpower.com,
	gcc@gcc.gnu.org, peter.osterlund@mailbox.swipnet.se
Subject: Re: Bug in loop optimize (invalid postinc to preinc transformation)
Date: Sun, 31 Dec 2000 08:30:00 -0000	[thread overview]
Message-ID: <20001231163045.5B3B534D81@nile.gnat.com> (raw)

<<Comparing pointers that don't point to the same (part of) object is
undefined.
>>

Indeed. The important thing to remember in C is that the semantic
model of a pointer is a pair (pointer-to-object, offset). Address
arithmetic just modifies the offset, comparison compares only the
offsets (and is undefined if the pointer-to-object values are
different).

Of course in practice the implementation is typically a single pointer
from a flat space, representing the sum of the two components, but the
proper semantic model needs to be kept in mind, and code that does not
respect this semantic model has undefined effects.

As C compilers get more clever, they are likely to be less permissive
to abuses of the semantics :-)

             reply	other threads:[~2000-12-31  8:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-31  8:30 dewar [this message]
2001-01-03  0:52 ` Jamie Lokier
  -- strict thread matches above, loose matches on Subject: below --
2000-12-29 18:43 dewar
2000-12-30 15:18 ` Toon Moene
2000-12-28 20:33 dewar
2000-12-28  5:40 Robert Dewar
2000-12-28 12:21 ` Alexandre Oliva
2000-12-28 14:32   ` Geoff Keating
2000-12-28 15:22     ` Tim Hollebeek
2000-12-28 22:20       ` Dave Korn
2000-12-29  0:52         ` Richard Henderson
2000-12-29  1:51         ` Tim Hollebeek
2000-12-28  1:14 Richard Kenner
2000-12-27 22:40 Robert Dewar
2000-12-29 18:36 ` Jamie Lokier
2000-12-27  3:04 Bug in loop optimize (TREE stage) David Korn
2000-12-27 15:42 ` Bug in loop optimize (invalid postinc to preinc transformation) Peter Osterlund
2000-12-27 19:55   ` Alexandre Oliva
2000-12-27 21:09     ` Torbjorn Granlund
2000-12-27 21:20       ` Alexandre Oliva
2000-12-27 22:24     ` Jamie Lokier
2000-12-31  8:25       ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20001231163045.5B3B534D81@nile.gnat.com \
    --to=dewar@gnat.com \
    --cc=aoliva@redhat.com \
    --cc=denisc@overta.ru \
    --cc=dkorn@pixelpower.com \
    --cc=egcs@tantalophile.demon.co.uk \
    --cc=gcc@gcc.gnu.org \
    --cc=peter.osterlund@mailbox.swipnet.se \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).