"Bingfeng Mei" <b...@broadcom.com> writes:

> Currently, trunk GCC generates following code (compile with
> -fschedule-insns -O2). Obviously, restrict is effective here
> even with inlining

> I am not very good at reading standard text. Does this
> behaviour conform to standard?

Yes.  The restrict qualifier promises that a function will not modify
the data to which the pointer points by using a different unrelated
pointer (a pointer which is not based on the restricted pointer, as
defined in C99 6.7.3.1).  That holds throughout the function, even if
the function calls other functions.


> Additionally, should "restrictness" be preserved over casting?

> GCC generates code that "restrict" is still effective. 
> foo:

> Does this conform to standard?

Yes.  Casting a restrict qualified pointer gives you a value based on
the restricted pointer.  It is still true that the data to which it
points may not be modified by an unrelated pointer.

Ian

Reply via email to