https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105876
--- Comment #3 from Kevin Hendricks <kevin.b.hendricks at icloud dot com> --- I thought the C++ spec said that static initialization is done in two phases. global (extern cost) variable are always initialized in the order they are declared first and local (dynamic) static initialization is always done second (and order across compilation units is undefined as your say). By definition isn't a global variable available in all translation units. When compiled *without* -flto, the compiler properly recognizes the extern const std::string variable as global while the static initializer in the sg_test class is considered local (all based on nm). In that case initialization order is global then local. But when compiled to -flto somehow the "extern" nature of the declaration is lost, and the variable becomes just another local static initializer and therefore the issue of a race (which is initialized first) happens. That should not be happening between a global (extern cost) and a local (sg_test class static const) object.