public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Karen Shaeffer <shaeffer@neuralscape.com>
Cc: Andrew Pinski <pinskia@gmail.com>, gcc@gnu.org
Subject: Re: auto const ints and pointer issue
Date: Wed, 18 Jun 2008 04:35:00 -0000	[thread overview]
Message-ID: <m3y7534azz.fsf@google.com> (raw)
In-Reply-To: <20080618035124.GA27477@synapse.neuralscape.com> (Karen Shaeffer's message of "Tue\, 17 Jun 2008 20\:51\:24 -0700")

Karen Shaeffer <shaeffer@neuralscape.com> writes:

> I see your point. My sticking point is that the process is actually
> running on a physical machine. And the addresses, although virtual,
> do translate to a unique physical memory location. And, the value
> stored in that location cannot be 0 and 5 at the same time. And my
> comments were addressing that the undefined behavior of this illegal
> assignment should not violate the physical constraints of what is
> actually stored in that physical address. I would be OK with -1
> being stored in there, or zero, or whatever, or the process crashing,
> but what I see is not congruent with my thinking about the limits
> of the compiled binary at run-time. Obviously I need to rethink those
> assumptions.

Undefined behaviour is undefined behaviour.  You can not predict what
the compiler do.  

> the value
> stored in that location cannot be 0 and 5 at the same time.

No, but in the presence of undefined behaviour the compiler is
perfectly free to assume that that is in fact the case.  This isn't
intentional, of course; it just falls out of other optimizations.

Ian

  reply	other threads:[~2008-06-18  4:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17 17:43 Karen Shaeffer
2008-06-17 18:02 ` Ian Lance Taylor
2008-06-17 19:38   ` Karen Shaeffer
2008-06-18  6:11     ` Re[2]: " Dmitry I. Yanushkevich
2008-06-18 10:20     ` Andrew Haley
2008-06-18 14:47       ` Karen Shaeffer
2008-06-18  1:44   ` Karen Shaeffer
2008-06-18  1:52     ` Andrew Pinski
2008-06-18  3:52       ` Karen Shaeffer
2008-06-18  4:35         ` Ian Lance Taylor [this message]
2008-06-18 12:53         ` jlh
2008-06-18 16:42         ` Joe Buck
2008-06-18 17:05           ` Karen Shaeffer

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=m3y7534azz.fsf@google.com \
    --to=iant@google.com \
    --cc=gcc@gnu.org \
    --cc=pinskia@gmail.com \
    --cc=shaeffer@neuralscape.com \
    /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).