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
On Sun, 2 Sep 2007, Mark Mitchell wrote:
> 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.
The rules that unmodified memory may alias were a deliberate change in the
FDIS relative to the previous public draft; see
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n866.htm>:
24 1. The FCD specification of restrict forbids aliasing of
25 unmodified objects. Doing so does not promote optimization,
26 and has other disadvantages, which are discussed in examples
27 A-E below. It is also contrary to the prior art in Fortran.
--
Joseph S. Myers
joseph@codesourcery.com