[Bug libstdc++/94810] std::cout segmentation fault in __attribute__((constructor)) function

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 28 16:09:43 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94810

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Maybe you misunderstood comment 3, the construction order is only unspecified
when you use __attribute__((constructor)). If you just create normal global
objects using normal C++ the order within a single translation unit is
completely specified, and your program would work as expected.

So again, why can't you just use standard C++ instead of attributes that aren't
needed in C++, and proposing non-conforming changes to the compiler?


More information about the Gcc-bugs mailing list