On 05/15/2014 09:58 AM, Ulrich Windl wrote:

I guess the problem is that constructors are called sequentially without 
dependency analysis. So if d() is acaaled before including iostream 
(lexically), the program crashes.

Yes, that's right. The C++ mechanism for initialization of global variables is fairly primitive. I'm not sure if GCC can do much about that because it's more or less what programmers expect, and more reliable mechanisms would have a performance impact (as long as dynamic linking with independent recompilation is supported).

(By the way, such questions are more appropriate for the gcc-help mailing list.)

--
Florian Weimer / Red Hat Product Security Team

Reply via email to