> If you are asking whether MSVC gets the right answer for the following snippet, the answer is yes - for both a Debug (/Od) and Release (/O2) build. ie, it correctly handles both no-overlap, and exact-overlap.
Okay but did VC generate code which handles exact overlapping because the compiler detected the exact overlap idiom or did the compiler generate code which was based on the assumption that the 2 arrays don't overlap at all but which just happens to work for exact overlap by coincidence?
You can't answer this question by examining the assembly generated. You can only answer it by examining the passes inside the compiler and/or by asking the team members who implemented these passes if they're aware of the exact overlap idiom and if the passes they wrote implemented it correctly.
e.g. if you ask a random compiler team member, "what is vadd1 supposed to do or why it was written that way?" could they answer "it adds arrays which either overlap exactly or don't overlap at all" and fully understand why?
> I'm not sure whether you are concerned that MSVC produces wrong answer in the presence of __restrict (we don't know of any). Or whether we ignore opportunities for optimizations (as permitted by the standard) that __restrict makes possible?
My concern is that the standard uses very tricky wording and the exact overlap idiom is not that obvious so I'm wondering if VC generated the correct code by design or by coincidence. I'm also trying to make the VC team members aware of this subtlety in the standard so they can continue to generate fast and correct code in the future.