This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: noalias macro bug [was: Linux and aliasing?]


>>>>> "Jamie" == Jamie Lokier <egcs@tantalophile.demon.co.uk> writes:

    Jamie> Prove me wrong :-)

First, it's silly to keep saying this.  We're outside standard
behavior, so "proof" based on standardese is not an issue.  Documented
behavior is one issue, and the code in GCC itself is another issue.
You *are* wrong, w.r.t. GCC; the "proof" is in GCC's code.

    Jamie> "The practice of reading a different union member than the
    Jamie> one most recently written..."

    Jamie> That does not apply -- in the example, no union member was
    Jamie> written.

Agreed, from a very language-lawyer-like point-of-view.  That is a
flaw in the manual's wording.  Please submit a patch, if you like.
The idea is that *all* accesses through a union type are permitted to
access any of the unionized fields.

    Jamie> I worry that 1. and hence 2. aren't true because of the
    Jamie> following argument:

    Jamie>   struct { int x, y; } s; int a;

    Jamie>   s.x = 1; *(&s.y) = 2; // 3. can this alias with `x'
    Jamie> according to the standard?  *(&a) = 3; // 4. can this alias
    Jamie> with `x' according to the standard?

Irrelevant.  This is a struct, so x and y are not at the same address.
Neither is `a'.  Type-based aliasing has nothing to do with this.  The
reasons these things don't alias is that they are different objects.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]