This is the mail archive of the
mailing list for the GCC project.
>>>>> "Jason" == Jason Merrill <firstname.lastname@example.org> writes:
> Perhaps what I want is, rather, to tell the optimizer that the value will
> not change behind its back; that the assignments we can see are all there
> is. That it can change, but cannot alias.
It seems that restrict provides this sort of guarantee; in this testcase,
can the compiler avoid doing two loads from *p?
void f ();
void g (int *__restrict p)
int j = *p;
j += *p;
i = j;
188.8.131.52/4 seems to say that any lvalue used to modify *p during the
execution of g must be based on p. Since f cannot name p, it can't create
such an lvalue, so we can assume that the call does not modify *p. Right?