[Bug tree-optimization/115693] 8 std::byte std::array comparison potential missed optimization
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jun 28 09:54:12 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115693
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #1)
> So it makes more sense to fix this in the optimization passes, instead of
> ad-hoc hack in libstdc++.
Yes, I agree, although we already have the hack in libstdc++ it just doesn't
work for std::byte:
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -1232,6 +1232,9 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
const bool __simple = ((__is_integer<_ValueType1>::__value
#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer)
|| __is_pointer(_ValueType1)
+#endif
+#if __glibcxx_byte
+ || __is_same(byte, _ValueType1)
#endif
) && __memcmpable<_II1, _II2>::__value);
return std::__equal<__simple>::equal(__first1, __last1, __first2);
> But I'm not sure if there already exists a dup.
The bug reported here is an exact dup of Bug 101485
More information about the Gcc-bugs
mailing list