https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93059
--- Comment #42 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to fdlbxtqi from comment #39) > Hi Jonathan. Another bug I found before and you haven't fixed: Have you reported it? > https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/ > stl_algobase.h#L1706 > > const auto __c = __builtin_memcmp(&*__first1, &*__first2, __len) <=> 0; > > > You cannot call &*__first, &*__first2 for contiguous_iterator since a lot of > implementations of contiguous iterators will check bounds at debugging mode > (for example MSVC's STL vector implementation). Yours will break code. How? The iterators are only dereferenced when __len is non-zero. And how would MSVC's vector be used with libstdc++ algorithms? Do you have a testcase demonstrating an actual problem? > __second is not allowed to dereference, that is UB. What is __second?