Subject: [Boost-bugs] [Boost C++ Libraries] #1531: segfault in dynamic_bitset::reference assign operator
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-12-20 20:37:31
#1531: segfault in dynamic_bitset::reference assign operator
-------------------------------------+--------------------------------------
Reporter: ben.collins_at_[hidden] | Owner: jsiek
Type: Bugs | Status: new
Milestone: Boost 1.35.0 | Component: dynamic_bitset
Version: Boost Development Trunk | Severity: Problem
Keywords: dynamic_bitset |
-------------------------------------+--------------------------------------
I will of course take a look at this later (i.e., I've go to stop here and
do the work I get paid to do), but for now, this will serve as a heads up
to any one who's interested. Perhaps I'm not initializing {{{bset}}}
correctly, but I couldn't easily tell that from the headers or the online
documentation.
test code:
{{{
$ cat bitset.cpp
#include <iostream>
#include <string>
#include <boost/dynamic_bitset.hpp>
int main()
{
boost::dynamic_bitset<> bset;
bset[0] = true;
bset[0] = false;
return 0;
}
}}}
compile + gdb session:
{{{
$ g++ -I ~/local/include/boost-1_35/ -o bitset bitset.cpp
$ ./bitset
Segmentation fault
$ g++ -g -I ~/local/include/boost-1_35/ -o bitset bitset.cpp
$ gdb bitset
GNU gdb Red Hat Linux (6.5-15.fc6rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/libthread_db.so.1".
(gdb) r
Starting program: /users/bcollins/test/C++/bitset
Program received signal SIGSEGV, Segmentation fault.
0x08048877 in boost::dynamic_bitset<unsigned long, std::allocator<unsigned
long> >::reference::do_set (this=0xbf856240)
at /users/bcollins/local/include/boost-
1_35/boost/dynamic_bitset/dynamic_bitset.hpp:115
115 void do_set() { m_block |= m_mask; }
(gdb) bt
#0 0x08048877 in boost::dynamic_bitset<unsigned long,
std::allocator<unsigned long> >::reference::do_set (this=0xbf856240)
at /users/bcollins/local/include/boost-
1_35/boost/dynamic_bitset/dynamic_bitset.hpp:115
#1 0x080488a3 in boost::dynamic_bitset<unsigned long,
std::allocator<unsigned long> >::reference::do_assign (this=0xbf856240,
x=true)
at /users/bcollins/local/include/boost-
1_35/boost/dynamic_bitset/dynamic_bitset.hpp:118
#2 0x080488d1 in boost::dynamic_bitset<unsigned long,
std::allocator<unsigned long> >::reference::operator= (this=0xbf856240,
x=true)
at /users/bcollins/local/include/boost-
1_35/boost/dynamic_bitset/dynamic_bitset.hpp:103
#3 0x080486c9 in main () at bitset.cpp:9
(gdb) f 0
#0 0x08048877 in boost::dynamic_bitset<unsigned long,
std::allocator<unsigned long> >::reference::do_set (this=0xbf856240)
at /users/bcollins/local/include/boost-
1_35/boost/dynamic_bitset/dynamic_bitset.hpp:115
115 void do_set() { m_block |= m_mask; }
(gdb) p m_block
$1 = (long unsigned int &) @0x0: Cannot access memory at address 0x0
(gdb)
}}}
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1531>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC