Boost logo

Boost Users :

Subject: Re: [Boost-users] Assertion `__null != bpos' failed in /inclu de/boost/archive/detail/oserializer.hpp:436
From: ktomaszewski_at_[hidden]
Date: 2011-01-21 07:14:27


Robert,
Changing the archive from Borg::SafeBinOutArchive to boost::archive::binary_oarchive will remove a core of the problem. In the constructor of Borg::SafeBinOutArchive I call register_type method to make my archive know about derived classes it will meet during serialization through base class pointers. But the constructor of boost::archive::binary_oarchive class doesn't do such things.

Things are much more weird...

In our team we have just discovered that the assert "/usr/local/boost/1.44/include/boost/archive/detail/oserializer.hpp:436: static void boost::archive::detail::save_pointer_type<Archive>::polymorphic::save(Archive&, T&) [with T = X::A, Archive = Borg::SafeBinOutArchive]: Assertion `__null != bpos' failed." is triggered depending on ORDER OF LINKING of object files (*.o) and thus this behaviour may be only present on GCC 4.4.1.

We have reproduced this in a small example (attachment). In this example we have to .CPP file which are compiled to .O files: test12.o and safe_bin_archive.o. We can link the program in following manners:

g++ -g -O0 test12.o safe_bin_archive.o -L/usr/local/boost/1.44/lib -static -lboost_serialization -o 1.out
g++ -g -O0 safe_bin_archive.o test12.o -L/usr/local/boost/1.44/lib -static -lboost_serialization -o 2.out
g++ -g -O0 safe_bin_archive.o -L/usr/local/boost/1.44/lib -static -lboost_serialization test12.o -o 3.out
g++ -g -O0 test12.o -L/usr/local/boost/1.44/lib -static -lboost_serialization safe_bin_archive.o -o 4.out

The results are:

1.out - OK
2.out - ASSERT: /usr/local/boost/1.44/include/boost/archive/detail/oserializer.hpp:436: static void boost::archive::detail::save_pointer_type<Archive>::polymorphic::save(Archive&, T&) [with T = X::A, Archive = Borg::SafeBinOutArchive]: Assertion `__null != bpos' failed.
3.out - ASSERT: /usr/local/boost/1.44/include/boost/archive/detail/oserializer.hpp:436: static void boost::archive::detail::save_pointer_type<Archive>::polymorphic::save(Archive&, T&) [with T = X::A, Archive = Borg::SafeBinOutArchive]: Assertion `__null != bpos' failed.
4.out - OK

Robert - from my perspective this looks like a bug. What do you think?

Kind regards,
Krzysztof Tomaszewski



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