https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667

--- Comment #54 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to post+gcc from comment #52)
> For the point discussed earlier with the `restrict` in the musl memcpy, I
> had another look at the definition of `restrict` and it's not entirely clear
> to me any more that there is UB here. The restrict rules only apply to
> objects that are "also modified (by any means)". Now the question is, does
> "*X = *X" modify the object? Is a write always a modification or only if the
> stores representation changes or only if the stored value changes?
> 
> If it requires a representation change, then "memcpy(x, x, n)" does not
> modify anything, and hence there is no UB from "restrict".

Heh, interesting splitting of hairs ;)  I guess you need to file a DR with the
language to resolve this question ...

Reply via email to