public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/42355] Segmentation fault with -g
Date: Tue, 20 Feb 2024 13:51:39 +0000	[thread overview]
Message-ID: <bug-42355-4-Oy2CtHcNs4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-42355-4@http.gcc.gnu.org/bugzilla/>

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.

      parent reply	other threads:[~2024-02-20 13:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-42355-4@http.gcc.gnu.org/bugzilla/>
2021-12-10  6:58 ` [Bug c++/42355] Segmentation fault pinskia at gcc dot gnu.org
2024-02-20 13:51 ` rguenth at gcc dot gnu.org [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-42355-4-Oy2CtHcNs4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).