|
Boost Users : |
From: Sascha Ochsenknecht (s.ochsenknecht_at_[hidden])
Date: 2007-07-17 14:12:39
Hello,
I have following class which I want to serialize:
template < class ValueType >
class Values {
private:
vector< ValueType > _values;
public:
Values(unsigned p_nr, const ValueType& p_value)
: _values(p_nr, p_value) {}
Values() {}
private:
friend class boost::serialization::access;
template < class Archive >
void load(Archive& p_ar, unsigned /*p_version*/) {
p_ar & _values;
}
template < class Archive >
void save(Archive& p_ar, unsigned /*p_version*/) const {
p_ar & _values;
}
BOOST_SERIALIZATION_SPLIT_MEMBER();
};
My main() looks very simple:
...
// save
const Values<std::string> a(3, "fritz");
{
std::ofstream ofs("fritz.txt");
boost::archive::text_oarchive ar(ofs);
ar << a;
}
// restore
Values<std::string> b;
{
std::ifstream ifs("fritz.txt");
boost::archive::text_iarchive ar(ifs);
ar >> b;
}
valgrind reports me following errors (the load() seems to be the problem):
==13202== Conditional jump or move depends on uninitialised value(s)
==13202== at 0x4E59F72:
boost::archive::detail::basic_iarchive::reset_object_address(void
const*, void const*) (in /usr/lib64/libboost_serialization.so.1.33.1)
==13202== by 0x408A2C:
boost::serialization::stl::archive_input_seq<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>::operator()(boost::archive::text_iarchive&, std::vector<std::string,
std::allocator<std::string> >&) (collections_load_imp.hpp:54)
==13202== by 0x408ABD: void
boost::serialization::stl::rebuild_collection<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >,
boost::serialization::stl::archive_input_seq<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> > >,
boost::serialization::stl::reserve_imp<std::vector<std::string,
std::allocator<std::string> > > >(boost::archive::text_iarchive&,
std::vector<std::string, std::allocator<std::string> >&)
(collections_load_imp.hpp:149)
==13202== by 0x408AF7: void
boost::serialization::stl::load_collection<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >,
boost::serialization::stl::archive_input_seq<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> > >,
boost::serialization::stl::reserve_imp<std::vector<std::string,
std::allocator<std::string> > > >(boost::archive::text_iarchive&,
std::vector<std::string, std::allocator<std::string> >&)
(collections_load_imp.hpp:171)
==13202== by 0x408B1E: void
boost::serialization::load<boost::archive::text_iarchive, std::string,
std::allocator<std::string> >(boost::archive::text_iarchive&,
std::vector<std::string, std::allocator<std::string> >&, unsigned)
(vector.hpp:58)
==13202== by 0x408B5D:
boost::serialization::free_loader<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>::invoke(boost::archive::text_iarchive&, std::vector<std::string,
std::allocator<std::string> >&, unsigned) (split_free.hpp:58)
==13202== by 0x408B87: void
boost::serialization::split_free<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>(boost::archive::text_iarchive&, std::vector<std::string,
std::allocator<std::string> >&, unsigned) (split_free.hpp:74)
==13202== by 0x408BB1: void
boost::serialization::serialize<boost::archive::text_iarchive,
std::string, std::allocator<std::string>
>(boost::archive::text_iarchive&, std::vector<std::string,
std::allocator<std::string> >&, unsigned) (vector.hpp:76)
==13202== by 0x408BEF: void
boost::serialization::serialize_adl<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>(boost::archive::text_iarchive&, std::vector<std::string,
std::allocator<std::string> >&, unsigned) (serialization.hpp:140)
==13202== by 0x408C29:
boost::archive::detail::iserializer<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>::load_object_data(boost::archive::detail::basic_iarchive&, void*,
unsigned) const (iserializer.hpp:160)
==13202== by 0x4E5A5B9:
boost::archive::detail::basic_iarchive::load_object(void*,
boost::archive::detail::basic_iserializer const&) (in
/usr/lib64/libboost_serialization.so.1.33.1)
==13202== by 0x4095F7:
boost::archive::detail::load_non_pointer_type<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>::load_standard::invoke(boost::archive::text_iarchive&,
std::vector<std::string, std::allocator<std::string> >&)
(iserializer.hpp:375)
==13202==
==13202== Conditional jump or move depends on uninitialised value(s)
==13202== at 0x4E59FA1:
boost::archive::detail::basic_iarchive::reset_object_address(void
const*, void const*) (in /usr/lib64/libboost_serialization.so.1.33.1)
==13202== by 0x408A2C:
boost::serialization::stl::archive_input_seq<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>::operator()(boost::archive::text_iarchive&, std::vector<std::string,
std::allocator<std::string> >&) (collections_load_imp.hpp:54)
==13202== by 0x408ABD: void
boost::serialization::stl::rebuild_collection<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >,
boost::serialization::stl::archive_input_seq<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> > >,
boost::serialization::stl::reserve_imp<std::vector<std::string,
std::allocator<std::string> > > >(boost::archive::text_iarchive&,
std::vector<std::string, std::allocator<std::string> >&)
(collections_load_imp.hpp:149)
==13202== by 0x408AF7: void
boost::serialization::stl::load_collection<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >,
boost::serialization::stl::archive_input_seq<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> > >,
boost::serialization::stl::reserve_imp<std::vector<std::string,
std::allocator<std::string> > > >(boost::archive::text_iarchive&,
std::vector<std::string, std::allocator<std::string> >&)
(collections_load_imp.hpp:171)
==13202== by 0x408B1E: void
boost::serialization::load<boost::archive::text_iarchive, std::string,
std::allocator<std::string> >(boost::archive::text_iarchive&,
std::vector<std::string, std::allocator<std::string> >&, unsigned)
(vector.hpp:58)
==13202== by 0x408B5D:
boost::serialization::free_loader<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>::invoke(boost::archive::text_iarchive&, std::vector<std::string,
std::allocator<std::string> >&, unsigned) (split_free.hpp:58)
==13202== by 0x408B87: void
boost::serialization::split_free<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>(boost::archive::text_iarchive&, std::vector<std::string,
std::allocator<std::string> >&, unsigned) (split_free.hpp:74)
==13202== by 0x408BB1: void
boost::serialization::serialize<boost::archive::text_iarchive,
std::string, std::allocator<std::string>
>(boost::archive::text_iarchive&, std::vector<std::string,
std::allocator<std::string> >&, unsigned) (vector.hpp:76)
==13202== by 0x408BEF: void
boost::serialization::serialize_adl<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>(boost::archive::text_iarchive&, std::vector<std::string,
std::allocator<std::string> >&, unsigned) (serialization.hpp:140)
==13202== by 0x408C29:
boost::archive::detail::iserializer<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>::load_object_data(boost::archive::detail::basic_iarchive&, void*,
unsigned) const (iserializer.hpp:160)
==13202== by 0x4E5A5B9:
boost::archive::detail::basic_iarchive::load_object(void*,
boost::archive::detail::basic_iserializer const&) (in
/usr/lib64/libboost_serialization.so.1.33.1)
==13202== by 0x4095F7:
boost::archive::detail::load_non_pointer_type<boost::archive::text_iarchive,
std::vector<std::string, std::allocator<std::string> >
>::load_standard::invoke(boost::archive::text_iarchive&,
std::vector<std::string, std::allocator<std::string> >&)
(iserializer.hpp:375)
I don't see any mistakes in my client code. Seems to be a problem of the
boost::serialization library. (I'm using boost 1.33.1)
Should I create a bug entry for that, or is it already known?
Regards,
Sascha
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