Hi Robert, On Wed, Dec 13, 2006 at 08:29:40AM -0800, Robert Ramey wrote:
I would be very interested in getting to the bottom of the problem. This would likely result in a small tweak which would make the library more portable. Of course I realise that this is not that easy. Note that I test here with gcc 3.3 under cywin. So I would be hopeful that its easily fixable. I don't know what version of boost your using, but it may already be fixed in a later version.
It looks like the problem is fixed (or at least, workaround-ed).
When I change
string serialize(const base * const b)
to
string serialize(base * const b)
the problem goes away (I don't get the segfault anymore).
I ran the regression tests on the suse (gcc 3.3.3) machine and the serialization tests all pass (except
for test_static_warning which gives a warn, but I guess that is what's supposed to happen).
I am going to use the workaround (remove the first 'const') and consider this thread closed.
Except when you want to investigate some more, I'll be glad to help, but then I need specific
instructions on what to test because this is getting a bit over my head ...
For completeness I included the original message once more at the bottom of this post.
Regards and thanks for your suggestions,
Oscar
-- Original Message:
currently I am trying to get serialization to work.
It worked well when I was using boost 1.32, but since I upgraded to 1.33 I'm having some problems.
In short;
I have an abstract base class and a derived class. I try to serialize/deserialize the derived class through a pointer to the
base
+class.
This worked well when I was using 1.32.
When I upgraded to 1.33 I got the static assert which trapped the 'saving non const error' (I hope this makes sense ..).
So I fixed it by following instructions from other posts dealing with the same problem (basically just by changing 'base *b'
to
+'const base * const b').
The fix resolved the compile error, only now I'm getting a segfault at runtime.
The segfault happens during deserialization (when trying to 'reconstruct' the original object).
The funny thing is, I've tested it on a system (suse enterprise system 9, gcc 3.3.3) and it chrashes.
On another system (gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)) it works fine.
I reproduced the problem in a very small program located at the end of this post. Maybe someone
can have a look at the code and tell me whether there are obvious problems with my code or not.
If I know for sure that my code should run correctly, I'll just move on to an other linux distro ..
Thanks in advance,
Oscar
#include