[Bug c++/117813] [14 Regression] GCC14 + -fsanitize=undefined + -Os + recursive_directory_iterator results in undefined reference since r14-5979-g99d114c15523e0

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 3 17:11:46 GMT 2024


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Unsure, that commit has been pure extra optimization.
I guess the problem here is
  extern template class
    __shared_ptr<filesystem::recursive_directory_iterator::_Dir_stack>;
Without that it would be purely up to the compiler to choose whether to emit a
C4 ctor or C1/C2 aliases, or C1 and C2 which calls C4, etc.
But when the template is extern, that decision becomes part of the ABI (and
libstdc++ in particular chooses to mostly emit both C1 and C2 (sometimes only
one of them is exported and the other one added later), current trunk has C1
vs. C2 parity.
And this isn't solely about libstdc++, guess one can use extern template in
other codebases as well and supply the template instantiations.


More information about the Gcc-bugs mailing list