> > I just updated from boost 1.32.0 to 1.33.0 and am seeing crashes in my
> > carbon/MSL application.
>
> Yes, I too had crashes in shared pointer code when using boost 1.33.
> Then I updated to even newer boost code obtained by CVS, and the
> crashes went away.
Just fyi, off the boost mailing list:
On Aug 21, 2005, at 4:56 PM, Howard Hinnant wrote:
On Aug 21, 2005, at 4:28 PM, Steve Ramsey wrote:
> I've had a number of programs crash after recompiling with the 1.33.0
> release and eventually tracked the problems down to shared_ptr,
> specifically the atomic_decrement function provided in
> sp_counted_base_cw_ppc.hpp.
Try these:
inline void atomic_increment( register long * pw )
{
register int a;
asm
{
loop:
lwarx a, 0, pw
addi a, a, 1
stwcx. a, 0, pw
bne- loop
}
}
inline long atomic_decrement( register long * pw )
{
register int a;
asm
{
sync
loop:
lwarx a, 0, pw
addi a, a, -1
stwcx. a, 0, pw
bne- loop
isync
}
return a;
}
inline long atomic_conditional_increment( register long * pw )
{
register int a;
asm
{
loop:
lwarx a, 0, pw
cmpwi a, 0
beq store
addi a, a, 1
store:
stwcx. a, 0, pw
bne- loop
}
return a;
}
-Howard
On Aug 23, 2005, at 10:32 AM, Howard Hinnant wrote:
On Aug 23, 2005, at 4:50 AM, Ben Artin wrote:
> I consider
> this a pretty serious error, and that I think we should understand how
> it came
> to pass.
The technical cause of the error is that there was an unforeseen
conflict between the CodeWarrior compiler's register allocation scheme,
and the original code, but only when the original was actually inlined
(the conflict disappeared with inlining off as might have easily
happened in a debug run). The bug had nothing to do with
multithreading or memory barriers per say, just that these issues were
what was being implemented.
The fix was to avoid explicitly naming registers in the assembly,
allowing the compiler to allocate registers at will with no chance for
conflict.
The bug was first detected (to my knowledge) by John Daub on Aug. 10.
I learned about it on Aug. 12, but was not able to look at it, diagnose
it, and suggest a fix until Aug. 15.
<shrug> bugs happen. Bugs of this nature won't be eradicated unless
you outlaw dropping into assembly (and I don't recommend that).
Perhaps an extended public beta of boost releases (all compressed and
easy to download) might help?
-Howard