public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/98731] s390x: Large classes of std::bitset and std::vector<bool> hash the same Date: Tue, 19 Jan 2021 18:02:50 +0000 [thread overview] Message-ID: <bug-98731-4-kveqnb42Eg@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-98731-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98731 --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- Yes the problem is that a bitset<2> uses the two least significant bits of an unsigned long, so we want to hash a single byte. But we take the address of the unsigned long and then hash the first byte. For BE we need to hash the last byte. With a bitset of more than 64 bits we have a layout like this: [76543210][...43210] We assume the value bytes are contiguous and just hash N bytes from the address of the first long, and then the next 5 bytes. We should be hashing the last 5 bytes of the last word instead. I haven't looked at hash<vector<bool>> but it's probably the same bug.
next prev parent reply other threads:[~2021-01-19 18:02 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-18 14:41 [Bug target/98731] New: " doko at debian dot org 2021-01-19 7:43 ` [Bug libstdc++/98731] " rguenth at gcc dot gnu.org 2021-01-19 10:00 ` redi at gcc dot gnu.org 2021-01-19 18:02 ` redi at gcc dot gnu.org [this message] 2021-01-21 11:35 ` redi at gcc dot gnu.org 2021-04-19 10:40 ` redi at gcc dot gnu.org 2021-09-29 18:15 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-98731-4-kveqnb42Eg@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).