https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14319

--- Comment #10 from Tim Rentsch <txr at alumni dot caltech.edu> ---
I would like to add a few comments to the discussion.

One:  C and C++ are different in how they treat unions.  My comments
here are about C.  I believe they apply to C++ as well, but I am not
as familiar with the C++ standard as the C standard, so please take
that into consideration.

Two:  The issue here is about how accesses involving struct and union
members interact with aliasing questions.  Clearly possible aliasing
is allowed IF one considers just the effective type rules (6.5 p6&7),
because the access types involved are both just 'int'.  What makes a
difference here is accesses being performed by way of the '->'
operator, and possible union membership for the objects in question.

Three:  The ISO C standard doesn't articulate clearly (at least, not
as clearly as I would like) what the aliasing implications are for
accesses involving struct and union members.  Obviously it would help
if the Standard were improved in this area.

Four:  Despite the last observation, the "one special guarantee" clause
(and hence also DR 257) is clearly not germane to this problem.  The
reason for this is that the "one special guarantee" clause is concerned
with read access ("inspect" is the word used in the Standard), but the
example code has no read accesses, only write accesses.  That paragraph
of the Standard is not relevant here.

Five:  For basically the same reason, this bug should not be considered
a duplicate of Bug 65892.  The example code in Bug 65892 _does_ involve
a read access, and the "one special guarantee" clause _is_ relevant to
that discussion.  Because of that, these two bugs should be separated
again, as their resolutions may be (and I believe probably will be)
different in the two cases.

I am expecting to post a separate comment for Bug 65892 shortly.

Reply via email to