https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42355
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2021-12-09 00:00:00 |2024-2-20 CC| |rguenth at gcc dot gnu.org Summary|Segmentation fault |Segmentation fault with -g --- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> --- Re-confirmed. GCC 14 crashed on me after allocating > 30GB of memory at /users/pfoelsch/boost_1_41_0/boost/mpl/joint_view.hpp:44:8: internal compiler error: Segmentation fault 0xf042a2 crash_signal /space/rguenther/src/gcc-forceslp/gcc/toplev.cc:317 0xefd3c3 ggc_alloc_string(char const*, int) /space/rguenther/src/gcc-forceslp/gcc/stringpool.cc:92 0x8292be pp_ggc_formatted_text(pretty_printer*) /space/rguenther/src/gcc-forceslp/gcc/cp/error.cc:3171 0x8292be decl_as_string(tree_node*, int) /space/rguenther/src/gcc-forceslp/gcc/cp/error.cc:3224 0x8292be decl_as_dwarf_string(tree_node*, int) /space/rguenther/src/gcc-forceslp/gcc/cp/error.cc:3212 0xae0fe4 type_tag /space/rguenther/src/gcc-forceslp/gcc/dwarf2out.cc:22459 0xb0bb08 gen_struct_or_union_type_die /space/rguenther/src/gcc-forceslp/gcc/dwarf2out.cc:26020 ... it seems to be an inherent issue with the way we produce DWARF for the types here, possibly duplicating a lot of long DW_AT_name strings (30GB worth of it). Changing the testcase to have typedef CDer1<8>::type CDer12; typedef CDer< boost::mpl::set< boost::mpl::long_<5>, boost::mpl::long_<4>, boost::mpl::long_<3>, boost::mpl::long_<2>, boost::mpl::long_<1>, boost::mpl::long_<0> > > CDer9; makes it "only" take 3.5GB and finish compiling. You then can see things like <3><e59>: Abbrev Number: 29 (DW_TAG_structure_type) <e5a> DW_AT_name : (indirect string, offset: 0x629): s_item<mpl_::long_<4>, boost::mpl::s_item<mpl_::long_<5>, boost::mpl::set0<mpl_::na> > > or <1><18a5>: Abbrev Number: 29 (DW_TAG_structure_type) <18a6> DW_AT_name : (indirect string, offset: 0x1b7f): CDer<boost:: mpl::s_item<mpl_::long_<7>, boost::mpl::s_item<mpl_::long_<6>, boost::mpl::s_ite m<mpl_::long_<5>, boost::mpl::s_item<mpl_::long_<4>, boost::mpl::s_item<mpl_::lo ng_<3>, boost::mpl::s_item<mpl_::long_<2>, boost::mpl::s_item<mpl_::long_<1>, bo ost::mpl::s_item<mpl_::long_<0>, boost::mpl::set0<mpl_::na> > > > > > > > >, dou ble> and worse. Interestingly enough we still end up throwing most stuff away ending up with just an 20kb object file. So I just guess we're somehow "recursively" building up the above strings, not re-using substrings but exponentially grow memory usage when producing them. There's definitely a cycle involving dump_type and dump_template_argument.