This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Hack to make restrict more useful
Daniel Berlin wrote:
> Again, I'd love to just ignore this and say "we don't care".
Ugh. I think you're right that the standard says that we only get to
assume non-aliasing when the pointed-to memory is modified, so
all-parameters-restrict is actually weaker than -fargument-noalias. How
unfortunate.
I've CC'd Joseph in the hopes that his C standards knowledge will
suggest a different answer.
> But we should not do it by saying "oh, well, this could never effect
> anything". It could. You can come up with transformations that
> break, and they all involve the compiler claiming a and b can't alias
> when they can.
Indeed. The most obvious example is:
return a != b;
If the compiler "knows" the pointers don't alias, the compiler will
happily, but wrongly, fold that to 1.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713