https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105876
--- Comment #7 from Kevin Hendricks ---
It kind of flies in the face of how g++ without -flto worked over the long term
(and clang++ and even the microsoft compiler) but ...
Thank you for taking the time to explain things.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105876
--- Comment #5 from Kevin Hendricks ---
It was declared in sg_constants.h as:
extern const std::string MAIN_EXTERN_CONST_STRING;
But why was its global nature lost:
Based on nm output:
./no_lto_test:1210 t
_GLOBAL__sub_I__Z24MAIN
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105876
--- Comment #3 from Kevin Hendricks ---
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 initializ
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105876
--- Comment #2 from Kevin Hendricks ---
Created attachment 53102
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53102&action=edit
zip archive with simple test case and build script
To make testing easier I have attached a small zip with t
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105876
Bug ID: 105876
Summary: use of -flto with g++ changes global extern const
std::string initialization in unexpected manner
Product: gcc
Version: 12.1.0
Status: UNCONFIRME