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.

Reply via email to