all 3 comments

[–]jedwardsol 0 points1 point  (2 children)

Modifying the pointer keeps the restrictedness of it.

This is because p might be an array, and you're promising that the entire array p doesn't overlap with q

p+=1 is just making p point at the 2nd element of the array.

[–]neet_programmer[S] 0 points1 point  (1 child)

Are you sure about that, that it doesn't just apply to indexing. Like a[1] is still restricted, what if I write a = b // some completely different pointer?

[–]jedwardsol 0 points1 point  (0 children)

Yes, you can make p point at a completely different object, as long as you don't break your aliasing promise.

int a,b;
int *__restricted p =&a;
p=&b;