[Bug libstdc++/115399] std::tr2::dynamic_bitset shift behaves differently from std::bitset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115399 Jonathan Wakely changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED Target Milestone|--- |15.0 --- Comment #5 from Jonathan Wakely --- Fixed on trunk. I'll probably backport it to the release branches at some point.
[Bug libstdc++/115399] std::tr2::dynamic_bitset shift behaves differently from std::bitset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115399 --- Comment #4 from GCC Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:bd3a312728fbf8c35a09239b9180269f938f872e commit r15-1213-gbd3a312728fbf8c35a09239b9180269f938f872e Author: Jonathan Wakely Date: Mon Jun 10 14:08:16 2024 +0100 libstdc++: Fix std::tr2::dynamic_bitset shift operations [PR115399] The shift operations for dynamic_bitset fail to zero out words where the non-zero bits were shifted to a completely different word. For a right shift we don't need to sanitize the unused bits in the high word, because we know they were already clear and a right shift doesn't change that. libstdc++-v3/ChangeLog: PR libstdc++/115399 * include/tr2/dynamic_bitset (operator>>=): Remove redundant call to _M_do_sanitize. * include/tr2/dynamic_bitset.tcc (_M_do_left_shift): Zero out low bits in words that should no longer be populated. (_M_do_right_shift): Likewise for high bits. * testsuite/tr2/dynamic_bitset/pr115399.cc: New test.
[Bug libstdc++/115399] std::tr2::dynamic_bitset shift behaves differently from std::bitset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115399 Jonathan Wakely changed: What|Removed |Added Keywords||wrong-code Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org Status|NEW |ASSIGNED
[Bug libstdc++/115399] std::tr2::dynamic_bitset shift behaves differently from std::bitset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115399 Jonathan Wakely changed: What|Removed |Added Last reconfirmed||2024-06-10 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #3 from Jonathan Wakely --- The tr2 extensions never even got proposed for standardization and are not in any ISO document at all. They're not well tested and nobody uses them.
[Bug libstdc++/115399] std::tr2::dynamic_bitset shift behaves differently from std::bitset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115399 Andrew Pinski changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=114498 --- Comment #2 from Andrew Pinski --- Note I think std::tr2 should be deprecated in a similar way as std::tr1 is being considered.
[Bug libstdc++/115399] std::tr2::dynamic_bitset shift behaves differently from std::bitset
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115399 --- Comment #1 from Oleksandr Kulkov --- The bug also affects right shift for a similar reason (https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/tr2/dynamic_bitset.tcc#L91): #include #include #include #include int main() { std::tr2::dynamic_bitset<> test(128); for (int i = 64; i < 128; i++) test[i] = 1; std::cout << test << "\n"; std::cout << (test >> 65) << "\n\n"; boost::dynamic_bitset<> test2(128); for (int i = 64; i < 128; i++) test2[i] = 1; std::cout << test2 << "\n"; std::cout << (test2 >> 65) << "\n\n"; std::bitset<128> test3; for (int i = 64; i < 128; i++) test3[i] = 1; std::cout << test3 << "\n"; std::cout << (test3 >> 65) << "\n\n"; } Output: 0111 0111 0111 See also https://github.com/emsr/tr2/issues/1.