5

I use boost's binary serialization and it worked well until now. I have std::list of pointers to serialize for output (oarchive) but serialization fails inside object's serialize() function with MSVC's dialog:

R6010 -abort() has been called

and such string is printed into console window:

Assertion failed: 0 == static_cast<int>(t) || 1 == static_cast<int>(t), file c:\program files\boost\boost_1_44\boost\archive\basic_binary_oprimitive.hpp, line 91

what does it mean?

Project is pretty big, sources are distributed so I cannot post it's code here, but I tried to simulate this error within simple project - there it works fine what is strange.

P.S. I use boost 1.44 with MSVC2010EE on Windows XP. When I click "retry" on "Debug Error!" window debugger shows arrow on the code line next to serialization archive << myList; line - I mean it seems like error occurred at some destructor or something. When I make changes inside objects serialize() function - they will be applied just when I rebuild whole project (clean before compiling) - but if I just compile it (where IDE shows that all sources which include changed header are recompiled) - no changes will happen at runtime since last version (I tried with printf()) - that's strange. Could I occasionally set some critical definitions or something?

Slaus
  • 2,086
  • 4
  • 26
  • 41
  • difficult to help without any code. Can you boil this down to a small reproducible example and include it here? – Sam Miller Feb 23 '11 at 15:20
  • If you go up the call stack a bit eventually you will get to the point where you can figure out what caused the problem, e.g,. which field in a struct – jrh May 28 '21 at 16:14

1 Answers1

9

The line in question says:

// trap usage of invalid uninitialized boolean which would
// otherwise crash on load.

It looks like at some point you are trying to serialize a bool that hasn't been initialized. Without further code we can't help you find which one.

Karl Bielefeldt
  • 47,314
  • 10
  • 60
  • 94
  • There is really bool! Just before crash! – Slaus Feb 23 '11 at 15:36
  • Hmm, what must I do then? #include ? - there is no such file. – Slaus Feb 23 '11 at 15:37
  • 4
    That means you are just declaring the variable `bool tmp;` without initializing it: `bool tmp = 0;` – karlphillip Feb 23 '11 at 15:40
  • A similar problem appears on certain platforms (e.g., MacOSX) when floats are not initialized. If you plant to serialize a variable, check to see whether you have given it a default value in the constructor. – Tymek Dec 17 '11 at 05:01
  • Additional information according to karlphillip's post: http://stackoverflow.com/questions/20243990/strange-bool-values – Anonymous Dec 30 '15 at 08:48