[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-28 Thread miladfarca at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 --- Comment #13 from mfarca --- Would you please backport this to 12 when the patch lands?

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-27 Thread miladfarca at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 --- Comment #12 from mfarca --- I've applied the above patch directly to `/usr/include/c++/12/bits/stl_algobase.h` under my fedora 36 env with gcc 12.2.1 and it solved the problem.

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 --- Comment #11 from Jonathan Wakely --- --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -1824,11 +1824,14 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO } #if __cpp_lib_three_way_comparison - // Iter

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 --- Comment #10 from Jonathan Wakely --- Oh I already defined a __is_memcmp_ordered_with trait, which does the same-size check. I think that's what should be used here.

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-27 Thread stefansf at linux dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 --- Comment #9 from Stefan Schulze Frielinghaus --- (In reply to Jonathan Wakely from comment #7) > We can't use memcmp if the sizes are different. We don't want to use the > min, we want to guard that code with the sizes being the same, then

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 --- Comment #8 from Jonathan Wakely --- --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -1824,8 +1824,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO } #if __cpp_lib_three_way_comparison - // Iter

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 --- Comment #7 from Jonathan Wakely --- Ohhh, I forgot I did that, sorry! Yeah, the memcmp code wasn't updated to match the different behaviour of __is_byte_iter for BE. We can't use memcmp if the sizes are different. We don't want to use the

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-27 Thread stefansf at linux dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 --- Comment #6 from Stefan Schulze Frielinghaus --- Guard __is_byte_iter checks for contiguous bytes which I guess is fine for std::vector and then checks for __is_memcmp_ordered which is fine for big-endian targets in conjunction with

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 --- Comment #5 from Jonathan Wakely --- But it's guarded by: if constexpr (__is_byte_iter<_InputIter1>) if constexpr (__is_byte_iter<_InputIter2>) This condition is only supposed to be true when sizeof(*__first1) == 1 and

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-27 Thread stefansf at linux dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 Stefan Schulze Frielinghaus changed: What|Removed |Added CC||jwakely at redhat dot com

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-27 Thread stefansf at linux dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 --- Comment #3 from Stefan Schulze Frielinghaus --- This seems to be a bug in the three way comparison introduced with C++20. The bug happens while deciding whether key v2 already exists in the map or not. template constexpr auto

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-18 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 Richard Biener changed: What|Removed |Added Ever confirmed|0 |1 Status|UNCONFIRMED

[Bug target/113960] std::map with std::vector as input overwrites itself with c++20, on s390x platform

2024-02-16 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113960 Sam James changed: What|Removed |Added CC||sjames at gcc dot gnu.org --- Comment #1