my question is related to the different semantics of the qualifier restrict in C and the noalias attribute in LLVM when they are used as functional parameters.
According to the LLVM documentation for noalias :
This indicates that objects accessed through pointer values โโbased on the argument or return value are also not accessed at run time through pointer values โโnot based on the argument or return value.
In the case of the restrict qualifier, the C11 project (example 3, p. 1212, section 6.7.3.1) sets an example where there is smoothing between the two arguments to restrict , which is fine if they only read data:
void h(int n, int * restrict p, int * restrict q, int * restrict r) { int i; for (i = 0; i < n; i++) p[i] = q[i] + r[i]; }
It seems to me that the above example does not satisfy the semantics of noalias . Is that the case?
source share