
I found it. The problem is in offset_ptr.hpp. A diff against the current trunk is below. Note that I just moved the ~. The problem is that gcc is treating pointers as 64 bit values but int and unsigned as 32 bit values. Just to verify this, when I run the program ... #include <iostream> using namespace std; unsigned u; int i; int main() { cout << sizeof(u) << ' ' << sizeof(&u) << endl; cout << sizeof(i) << ' ' << sizeof(&i) << endl; cout << sizeof(size_t) << endl; } ... the output is ... 4 8 4 8 8 In the original code the ~ only complemented the 32 bit unsigned value. When the value was expanded into a size_t the value isn't sign extended so the upper 32 bits wind up being zero. Since this is used as an address mask the upper half of the address is zeroed. This is gcc 4.1.1 on kernel 2.6.20-1.2948.fc6 in case anybody is interested. -glenn % svn diff Index: boost/interprocess/offset_ptr.hpp =================================================================== --- boost/interprocess/offset_ptr.hpp (revision 39447) +++ boost/interprocess/offset_ptr.hpp (working copy) @@ -384,7 +384,7 @@ typedef boost::interprocess::offset_ptr<T> pointer; static pointer get_pointer(const pointer &n) - { return (T*)(std::size_t(n.get()) & std::size_t(~2u)); } + { return (T*)(std::size_t(n.get()) & ~std::size_t(2u)); } static void set_pointer(pointer &n, pointer p) { n = (T*)(std::size_t(p.get()) | (std::size_t(n.get()) & std::size_t(2u))); } % Glenn Schrader wrote:
Ion,
I will attempt to find the check in date where this problem first showed up. This ought to at least narrow down the possibilities.
-glenn
Ion GaztaƱaga wrote:
Glenn Schrader wrote:
Using gdb I get the following seg fault. I also included a backtrace.
Thanks for the info. Unfortunately, the lap from work (Centrino Core Duo) were I wanted to install 64 bit linux is not a 64bit processor (it seems that Core Duo 2 is 64 bit but no Core Duo), so I really don't know how to starting solving this :-(
Regards,
Ion _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost