public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: brendan@zen.org To: gcc-gnats@gcc.gnu.org Subject: libstdc++/3018: bug in std_bitset.h for bitset<>::test method Date: Thu, 31 May 2001 15:06:00 -0000 [thread overview] Message-ID: <20010531215831.29696.qmail@sourceware.cygnus.com> (raw) >Number: 3018 >Category: libstdc++ >Synopsis: bug in std_bitset.h for bitset<>::test method >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu May 31 15:06:03 PDT 2001 >Closed-Date: >Last-Modified: >Originator: brendan@zen.org >Release: egcs3 branch >Organization: >Environment: >Description: Attached is a tweak to fix the test() method in the bitset template class. The comparison should be looking at pos being >= the number of bits, not just > the number. Hope this helps, B >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="diffs-bitset.txt" Content-Disposition: inline; filename="diffs-bitset.txt" 2001-05-31 Brendan Kehoe <brendan@zen.org> * include/bits/std_bitset.h (bitset::test): Fix comparison to check __pos >= _Nb, since __pos also cannot be == _Nb given that the bits are values 0 to _Nb-1, not 0 to _Nb. Index: std_bitset.h =================================================================== RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/std_bitset.h,v retrieving revision 1.3.6.2 diff -u -p -r1.3.6.2 std_bitset.h --- std_bitset.h 2001/05/14 19:49:03 1.3.6.2 +++ std_bitset.h 2001/05/31 21:52:15 @@ -629,7 +629,7 @@ public: } bool test(size_t __pos) const { - if (__pos > _Nb) + if (__pos >= _Nb) __STL_THROW(out_of_range("bitset")); return _Unchecked_test(__pos);
reply other threads:[~2001-05-31 15:06 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20010531215831.29696.qmail@sourceware.cygnus.com \ --to=brendan@zen.org \ --cc=gcc-gnats@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).