https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116369
Bug ID: 116369 Summary: [DEBUG MODE,C++20] access to iterators from global empty container defined by "const&" results in SIGSEGV Product: gcc Version: 14.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: piotrwn1 at gmail dot com Target Milestone: --- Starting from C++20 (C++23 too) and gcc14.1, with STL debug mode ON (-std=c++20 -D_GLIBCXX_DEBUG) the following code starts producing SIGSEGV: #include <vector> const std::vector<int>& a{}; int main() { (void)a.begin(); } The obvious workaround, changing to "const std::vector<int> a{};" works. Also the problem is not visible with local vector, only for globals. And only visible in GLIBC debug mode. Not also visible in clang - so maybe this is the gcc compiler issue. Compiler Explorer link: https://godbolt.org/z/PKnbavGe6