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

            Bug ID: 113960
           Summary: std::map with std::vector as input overwrites itself
                    with c++20, on s390x platform
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: miladfarca at gmail dot com
  Target Milestone: ---
              Host: s390x
            Target: s390x

```
#include <map>
#include <vector>
#include <iostream>

int main(){
 std::vector<unsigned short> v1 = {1}; 
 std::vector<unsigned short> v2 = {2};

 std::map<std::vector<unsigned short>, int> m;
 m[v1] = 1;
 m[v2] = 2; // this overwrites m[v1]

 std::cout << m.size() << std::endl; // prints 1, should be 2

 return 0;
}

```
Compile with `g++ std=c++20`. Output is correct with c++17. Tested on g++
12.2.1 and g++ 13.2.1

Reply via email to