Problem serializing (restoring) through base pointer

I have spent several hours combing the documentation and archives, but
can't seem to find an answer to my problem.
I have an abstract base class, Operation with a pure virtual function
'double value() = 0'. I derive a class, BinaryOperation from
Operation. It takes as arguments an operation type (+, -, *, /) and
two Operation pointers --- one for the left operand, one for the
right. It stores these two pointers internally and uses them when the
value() method is invoked.
I derive two more classes from Operation, trivial, made-up, useless
ones. One is called IncrementOperation, one is called
DecrementOperation.
I can save to an XML archive properly, but when I try to restore, it
core dumps. I am running gcc-3.2. I have tried everything I can
think of, but am stuck. I have tried using polymorphic_xml_iarchive
(and corresponding output version), but it still fails.
The first few stack frames from GDB are:
#0 0x0808897f in ?? ()
#1 0x08052f7d in boost::archive::detail::basic_iarchive::load_pointer(void*&, boost::archive::detail::basic_pointer_iserializer const*, boost::archive::detail::basic_pointer_iserializer const* (*)(boost::serialization::extended_type_info const&)) ()
#2 0x0804c78a in boost::archive::detail::load_pointer_type

Bill Lear wrote:
I have spent several hours combing the documentation and archives, but can't seem to find an answer to my problem.
Should work as far as I'm concerned. I did build it and test it with vc 7.1 and it ran fine. When I get a little time I'll try gcc 3.3. I don't have gcc 3.2 on my machine. I notice that gcc 3.2.3 on linux passes all serialization tests (http://www.meta-comm.com/engineering/boost-regression/developer/serializati on.html ) so its not a known problem. I would suggest the following: a) try a text archive. This would tell us if its related to the specific type of archive. b) step through the code to determine the statement that fails. I know this is a pain, but clearly something that is presumed to be working is not in fact working as expected. This is the only way to fix find this. Robert Ramey

On Monday, January 3, 2005 at 09:19:02 (-0800) Robert Ramey writes:
Bill Lear wrote:
I have spent several hours combing the documentation and archives, but can't seem to find an answer to my problem.
Should work as far as I'm concerned. [...]
I have discovered a way to cause the program to run properly, albeit with a workaround that I would rather not use. If I change the base class so that it is no longer abstract, and do not use the BOOST_IS_ABSTRACT macro, the thing works properly. Any idea on how I can fix things so I can keep the base class abstract? Thanks for the help. Bill

It seems to me that you've discovered a bug in the serialization library the seems to manifest itself (so far) in gcc 3.2 . Given a little time, we can verify if this is the case. So, if I were you I would use your solution until this gets resolved in the appropriate place. Robert Ramey Bill Lear wrote:
On Monday, January 3, 2005 at 09:19:02 (-0800) Robert Ramey writes:
Bill Lear wrote:
I have spent several hours combing the documentation and archives, but can't seem to find an answer to my problem.
Should work as far as I'm concerned. [...]
I have discovered a way to cause the program to run properly, albeit with a workaround that I would rather not use. If I change the base class so that it is no longer abstract, and do not use the BOOST_IS_ABSTRACT macro, the thing works properly.
Any idea on how I can fix things so I can keep the base class abstract?
Thanks for the help.
Bill

On Monday, January 3, 2005 at 12:22:42 (-0800) Robert Ramey writes:
It seems to me that you've discovered a bug in the serialization library the seems to manifest itself (so far) in gcc 3.2 . Given a little time, we can verify if this is the case. So, if I were you I would use your solution until this gets resolved in the appropriate place.
Very good and thank you for your help. Bill

On Monday, January 3, 2005 at 12:22:42 (-0800) Robert Ramey writes:
It seems to me that you've discovered a bug in the serialization library the seems to manifest itself (so far) in gcc 3.2 . Given a little time, we can verify if this is the case. So, if I were you I would use your solution until this gets resolved in the appropriate place.
I decided to try out g++ 3.4.3. So, I removed all my boost libraries and headers from my system, and rebuilt boost 1.32 from scratch. I still get a seg fault when I try to use abstract base classes. Bill

Thanks for the info, I'll test it on my gcc systems here. Robert Ramey Bill Lear wrote:
On Monday, January 3, 2005 at 12:22:42 (-0800) Robert Ramey writes:
It seems to me that you've discovered a bug in the serialization library the seems to manifest itself (so far) in gcc 3.2 . Given a little time, we can verify if this is the case. So, if I were you I would use your solution until this gets resolved in the appropriate place.
I decided to try out g++ 3.4.3. So, I removed all my boost libraries and headers from my system, and rebuilt boost 1.32 from scratch. I still get a seg fault when I try to use abstract base classes.
Bill
participants (2)
-
Bill Lear
-
Robert Ramey