Peter Dimov wrote:
Eyal Fink wrote:
I am using boost share_ptr and I have a very strange problem. it looks to me more like a compiler problem but since it is a boost code I decided to post it here. I haven't succeeded to creating a small example which I can post here and demonstrate the problem (I know it is hard to help that way but I am working on creating an example) so I will just describe it. The symptom is that the shared_ptr call the delete on a random pointer. Going into the shared_ptr and shared_count objects, I sow that the ptr field of sp_counted_base_impl has a wrong value. I have added prints out all over the code and saw that inside the constructor of sp_counted_base_impl the value is set correctly but on the return when I try to look at the value and it is a wrong value. adding some more prints I saw that inside the shared_count constructor: template
shared_count(P p, D d) when casting pi_ to (sp_counted_base_impl *) and calling a member function, the sizeof(*this) in side the member function is not the same every time (resulting with a different address to ptr and thus different value). the problem occurs only when compiling -O
Very odd; looks like either optimizer problem or ABI mismatch. Have you tried g++ 3.2.3 or 3.3.2?
I have not tried newer versions yet (I have tried 2.9.5 and it happens there as well) what is ABI mismatch?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users