Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2005-12-21 12:04:45


>> Yes, that's another possibility, but it breaks binary compatibility -
>> surely a black mark against a bug fix? - and I would expect 32-bit
>> accesses to be a little less efficient. It's fairly easy to select at
>> compile time, in any case. I'm attaching a patch against Boost CVS
>> HEAD
>> that should make it work with both 32-bit and 64-bit longs. Could you
>> test this on HP-UX, David?

You are right that int's and pointers are 32-bit:

    sizeof(short) =2
    sizeof(int) =4
    sizeof(long) =4
    sizeof(size_t) =4
    sizeof(ptrdiff_t) =4
    sizeof(void*) =4
    sizeof(void(*)(void)) =4
    sizeof(float) =4
    sizeof(double) =8
    sizeof(long double) =16
    CHAR_BIT =8
    CHAR_MAX =127
    SHRT_MAX =32767
    INT_MAX =2147483647
    LONG_MAX =2147483647L
    LONG_LONG_MAX =9223372036854775807LL
    ULONG_LONG_MAX =(9223372036854775807LL * 2ULL +
ULL)

But your fix still segfaults:

bash-2.05b$ gdb *test
HP gdb 5.2 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 5.2 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for
warranty/support.
..
(gdb) run
Starting program:
/house/maddock/bin/boost/libs/smart_ptr/test/smart_ptr_test.te
st/gcc/debug/smart_ptr_test
UDT with value 999888777 being destroyed
UDT with value 111222333 being destroyed

Program received signal SIGSEGV, Segmentation fault
  si_code: 1 - SEGV_MAPERR - Address not mapped to object.
0x400f041 in boost::detail::atomic_increment (pw=0x40012b94)
    at sp_counted_base_gcc_ia64.hpp:51
51 "r"(pw));
(gdb) bt
#0 0x400f041 in boost::detail::atomic_increment (pw=0x40012b94)
    at sp_counted_base_gcc_ia64.hpp:51
#1 0x400f500 in boost::detail::sp_counted_base::add_ref_copy
(this=0x40012b90)
    at sp_counted_base_gcc_ia64.hpp:130
#2 0x400f970 in boost::detail::shared_count::shared_count (this=0x7ffff30c,
    r=@0x7ffff304) at shared_count.hpp:216
#3 0x4010d70 in boost::shared_ptr<int>::boost::shared_ptr<int> (
    this=0x7ffff308) at shared_ptr.hpp:116
#4 0x400ad40:0 in test () at smart_ptr_test.cpp:165
#5 0x400ec50:0 in main () at smart_ptr_test.cpp:308

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net