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]
Other format: [Raw text]

Re: GCC aliasing rules: more aggressive than C99?


Robert Dewar <dewar <at> adacore.com> writes:
> In any case the gcc interpretation is clearly what's
> intended in my view, so if it can be argued that the
> standard is inconsistent with this interpretation (I
> am unconvinced that this burden has been met), then
> the conclusion is to add a clarification to the
> standard, not to modify the gcc behavior.

I agree with you completely on this point.  My position throughout this
thread has been that GCC should keep its existing type-based aliasing
behavior.  I think the GCC policy represents a good trade-off between a
policy that is not aggressive enough and a policy that is too hard to
follow.

In my view the C99 standard quite clearly specifies a policy that is
less aggressive than what GCC implements.  I think it's hard to come to
any other conclusion; section 6.5 paragraph 7 contains a footnote
explicitly stating that the intention is to specify conditions under
which values may be aliased, and one of the rules allows for an aliasing
condition that GCC does not respect.  I have not heard any credible 
rebuttal to this point, or any explanation of what 6.5 paragraph 7 
*does* mean, if it is not intended to specify aliasing rules.

I am guessing that the committee didn't have enough practical experience
with aliasing policies to come to Richard's conclusion that the
standard's policy "removes nearly all advantages of type-based aliasing
that you have when dealing with disambiguating a pointer dereference vs.
an object reference."  In this sense I think this is a bug in the 
standard, and I hope the committee will take it up in C1x.

Josh


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