public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115399] New: std::tr2::dynamic_bitset shift behaves differently from std::bitset
@ 2024-06-08 21:21 adamant.pwn at gmail dot com
  2024-06-08 22:17 ` [Bug libstdc++/115399] " adamant.pwn at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: adamant.pwn at gmail dot com @ 2024-06-08 21:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115399
           Summary: std::tr2::dynamic_bitset shift behaves differently
                    from std::bitset
           Product: gcc
           Version: 14.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: adamant.pwn at gmail dot com
  Target Milestone: ---
            Target: x86-64 Linux
             Build: 20240522

Posting a bug on behalf of someone who didn't manage to create an account at
GCC bugzilla due to automatic registration being disabled...

The bug is due to the line
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/tr2/dynamic_bitset.tcc#L63
being commented out in dynamic_bitset implementation (unlike std::bitset, where
it is present). Uncommenting it should fix the problem.

A simple example program to highlight the discrepancy:

#include <iostream>
#include <bitset>
#include <tr2/dynamic_bitset>

int main() {
    std::tr2::dynamic_bitset<> test(91);
    test[50] = true;
    std::cout << test << "\n";
    std::cout << (test << 78) << "\n";
    std::cout << "\n";

    std::bitset<91> test2;
    test2[50] = true;
    std::cout << test2 << "\n";
    std::cout << (test2 << 78) << "\n";
}

Output:

0000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000

0000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-06-12 15:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-08 21:21 [Bug c++/115399] New: std::tr2::dynamic_bitset shift behaves differently from std::bitset adamant.pwn at gmail dot com
2024-06-08 22:17 ` [Bug libstdc++/115399] " adamant.pwn at gmail dot com
2024-06-08 22:50 ` pinskia at gcc dot gnu.org
2024-06-10  8:46 ` redi at gcc dot gnu.org
2024-06-10 11:38 ` redi at gcc dot gnu.org
2024-06-12 14:07 ` cvs-commit at gcc dot gnu.org
2024-06-12 15:57 ` redi at gcc dot gnu.org

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).