summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-14 17:01:49 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-14 17:01:49 +0000
commit03a72b0fe5b07e96de0fe4343b3d493030fbc2a3 (patch)
treec01de593f8968a43cb28ad388afc1f6c5d2f5f09 /libstdc++-v3
parent70bc073040f760d67ec8d2a3f329ff8a3482faf7 (diff)
downloadppe42-gcc-03a72b0fe5b07e96de0fe4343b3d493030fbc2a3.tar.gz
ppe42-gcc-03a72b0fe5b07e96de0fe4343b3d493030fbc2a3.zip
2004-05-14 Paolo Carlini <pcarlini@suse.de>
Ivan Godard <igodard@pacbell.net> PR libstdc++/15361 * include/std/std_bitset.h (_Base_bitset<_Nw>::_M_do_find_next): Fix. * testsuite/23_containers/bitset/ext/15361.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81852 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/std/std_bitset.h6
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc40
3 files changed, 50 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f4cf9ae4b76..6b447610520 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2004-05-14 Paolo Carlini <pcarlini@suse.de>
+ Ivan Godard <igodard@pacbell.net>
+
+ PR libstdc++/15361
+ * include/std/std_bitset.h (_Base_bitset<_Nw>::_M_do_find_next): Fix.
+ * testsuite/23_containers/bitset/ext/15361.cc: New.
+
2004-05-13 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/15046
diff --git a/libstdc++-v3/include/std/std_bitset.h b/libstdc++-v3/include/std/std_bitset.h
index fba62c15bca..01e3f904e47 100644
--- a/libstdc++-v3/include/std/std_bitset.h
+++ b/libstdc++-v3/include/std/std_bitset.h
@@ -1,6 +1,6 @@
// <bitset> -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -290,7 +290,7 @@ namespace _GLIBCXX_STD
++__prev;
// check out of bounds
- if ( __prev >= _Nw * _GLIBCXX_BITSET_BITS_PER_WORD )
+ if (__prev >= _Nw * _GLIBCXX_BITSET_BITS_PER_WORD)
return __not_found;
// search first word
@@ -298,7 +298,7 @@ namespace _GLIBCXX_STD
_WordT __thisword = _M_w[__i];
// mask off bits below bound
- __thisword >>= __prev + 1;
+ __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev);
if (__thisword != static_cast<_WordT>(0))
return __i * _GLIBCXX_BITSET_BITS_PER_WORD
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc b/libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc
new file mode 100644
index 00000000000..e42d6498e4e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2004 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <bitset>
+#include <testsuite_hooks.h>
+
+// libstdc++/15361
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ bitset<256> b;
+ b.set(225);
+ b.set(226);
+
+ VERIFY( b._Find_first() == 225 );
+ VERIFY( b._Find_next(225) == 226 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
OpenPOWER on IntegriCloud