Assert depending on the order of object files during linking

What a ridiculous condition?!? Is it possible? Unfortunately yes…

An assert statement was triggered in a C++ program depending on the order of object files during linking. It happened to me with Boost.serialization in version 1.44 and GCC v4.4.1 (Linux). I tried to serialize an object through a shared pointer to the base class of this object.

Looks like a bug in GCC or in… Boost.serialization. I posted a message to Boost-users mailing list – have a look.

Reordering object files in a command invoking GCC to link the program changed situation from “assertion failed” to “no assert, no exceptions and correct behaviour”!

Welcome to the real world of C++…

Advertisements

About krzysztoftomaszewski

I've got M.Sc. in software engineering. I graduated in 2005 at Institute of Computer Science, Warsaw University of Technology, Faculty of Electronics and Information Technology. I'm working on computer software design and engineering continuously since 2004.
This entry was posted in C++ and tagged , , , , . Bookmark the permalink.

One Response to Assert depending on the order of object files during linking

  1. It was a bug in Boost v1.44 (at least with GCC 4.4.1). After updating to Boost v1.45 the mysterious bug completely dissappeared! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s