As Mats Petersson correctly stated, you are trying to construct a std::string
from a const char *
, that is NULL
.
The likely reason this didn't happen with older GCC and is happening with newer one is that GCC-4.7 stopped using .ctors
and started usting .init_array
. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770
As Mats Petersson also likely correctly guessed, you have depended on initializer order between separate compilation units, and now that this order changed (the order is undefined), you are paying the price.
We had this exact problem in a codebase of 100+ MLOC, and our solution is to reconfigure GCC with configure --disable-initfini-array ...
(we build our own GCC releases).
Note that some platforms (e.g. ARM
) do not support .ctors
, only .init_array
s.