
Hi, I had some trouble with this, so I decided to try it out. The optimizations that cause the problem with MSVC is /Og and /Ob2 together (which are both part of /O2, optimize for speed). As Ion says it is function inlining that is the problem, since when i added __declspec(noinline) to set_offset it all worked like a dream. Here is a very ugly fix for this problem (just an ifdef and a __declspec): Index: offset_ptr.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/interprocess/offset_ptr.hpp,v retrieving revision 1.2 diff -u -r1.2 offset_ptr.hpp --- offset_ptr.hpp 7 Aug 2006 13:52:22 -0000 1.2 +++ offset_ptr.hpp 2 Feb 2007 12:44:25 -0000 @@ -51,6 +51,11 @@ void unspecified_bool_type_func() const {} typedef void (self_t::*unspecified_bool_type)() const; +#if (defined _MSC_VER) && (_MSC_VER >= 1200) + //a bug in VC8.0 (and maybe earlier?) makes having this + //inlined in release mode break things. + __declspec(noinline) +#endif void set_offset(const void *ptr) { //offset == 1 && ptr != 0 is not legal for this pointer When I install SP1 for VC8 I will let you know if this problem disappears. Lars P.S. I believe this may have been the problem I mentioned before that I had with interprocess/deque. Ion Gaztañaga wrote:
Hi,
I don't exactly reproduce your problem (my program just crashes in release mode) but I've found something tricky in my code:
-> If we use raw pointer instead of offset_ptr there is no problem. -> If I make offset_ptr::set_offset function non-inline (taking it out of the class definition) my problem goes away.
I suspect that function inlining in VC8 is hurting something. Can you try to make offset_ptr::sey_offset non-inline and report your results?
I will try to guess if that's the only problem.
Regards,
Ion _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users