Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: elaborated on line added by svoboda

...

Note that undefined behavior occurs only when a is assigned to b. There is no problem when It is valid for a and b point to within reference  the same array , because they point to non-overlapping objectsobject because what matters is which elements are accessed.  Provided the range of elements accessed through one of the pointers does not overlap with the range of elements accessed through the other pointer, there is no undefined behavior.

Compliant Solution

One way to eliminate the undefined behavior is simply to remove the restrict-qualification from the affected pointers. 

...