public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Dan Nicolaescu <dann@godzilla.ICS.UCI.EDU>
Cc: libstdc++@gcc.gnu.org, gcc@gcc.gnu.org
Subject: Re: C++ aliasing rules
Date: Tue, 23 Apr 2002 13:59:00 -0000	[thread overview]
Message-ID: <wvlvgai92dc.fsf@prospero.cambridge.redhat.com> (raw)
In-Reply-To: <200204031103.aa15838@gremlin-relay.ics.uci.edu> (Dan Nicolaescu's message of "Wed, 03 Apr 2002 11:03:11 -0800")

>>>>> "Dan" == Dan Nicolaescu <dann@godzilla.ICS.UCI.EDU> writes:

> struct first  {  int i; char a;  int f1;  char f2; double d;};
> struct second {  char b;  int f2;  int f3;};

> can it be assumed that given that "first" and "second" are
> incompatible then ps1.f1 and ps2.f2 don't alias

I'm not sure.  I suppose it depends on whether you consider ps1.f1 to be an
object for the purposes of [basic.lval], which says that an object can be
referenced through an lvalue of a class type which contains a member of
that object's type.  So since ps1.f1 is an int, and struct second contains
an int, the access can alias.

If we think that [basic.lval] only means to talk about complete objects,
then the access can't alias.

I'm not sure what the intent is, but from a strict reading I tend towards
the first interpretation; according to [intro.object] sub-objects are
objects, too.

Jason

       reply	other threads:[~2002-04-23 20:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200204031103.aa15838@gremlin-relay.ics.uci.edu>
2002-04-23 13:59 ` Jason Merrill [this message]
2002-04-23 19:52   ` mike stump
2002-04-24  6:43     ` Andreas Schwab
2002-04-24 13:32     ` Dan Nicolaescu
2002-04-25  1:11       ` Nathan Sidwell
2002-04-25 10:57       ` Jason Merrill
2002-04-25 17:44         ` mike stump
2002-05-17 13:09           ` Dan Nicolaescu

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=wvlvgai92dc.fsf@prospero.cambridge.redhat.com \
    --to=jason@redhat.com \
    --cc=dann@godzilla.ICS.UCI.EDU \
    --cc=gcc@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /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).