From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DD75F3857C4E; Mon, 18 Jan 2021 14:41:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DD75F3857C4E From: "doko at debian dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/98731] New: s390x: Large classes of std::bitset and std::vector hash the same Date: Mon, 18 Jan 2021 14:41:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: doko at debian dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 14:41:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98731 Bug ID: 98731 Summary: s390x: Large classes of std::bitset and std::vector hash the same Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: doko at debian dot org Target Milestone: --- [forwarded from https://bugs.debian.org/977638] same behavior with GCC 8, 9 and 10. On s390x, std::hash returns identical values for large classes of std::bitset and std::vector: $ cat bug.cc #include #include #include #include int main() { std::bitset<2> a("00"), b("01"); std::vector c =3D {false, true, false, true}; std::vector d =3D {true, false, true, false}; std::bitset<9> e("000000000"), f("010101010"); std::vector g =3D {true, true, true, true, true, true, true, tr= ue, true}; std::vector h =3D {false, false, false, true, true, false, false, false, false}; std::hash> h1; std::hash> h2; std::hash> h3; std::cout << h1(a) << '\n' << h1(b) << '\n' << h3(c) << '\n' << h3(d) << "\n\n" << h2(e) << '\n' << h2(f) << '\n' << h3(g) << '\n' << h3(h) << '\n'; } $ g++ -o bug bug.cc $ ./bug 7857072875483051545 7857072875483051545 7857072875483051545 7857072875483051545 4158372090644325695 4158372090644325695 4158372090644325695 4158372090644325695 It appears that the hash value is completely dependent on the size of the object in bytes. 1=E2=80=938-bit values all hash to 7857072875483051545; 9=E2=80=9316-bit values all hash to 4158372090644325695; and though bug.cc doesn=E2=80=99t demonstrate it, 17-bit values hash to 14756137038141193723.=