public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "StevenSun2021 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/100877] g++ freezes system by consuming infinite amount of memory
Date: Thu, 03 Jun 2021 03:36:07 +0000	[thread overview]
Message-ID: <bug-100877-4-D6XJyeVGRD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100877-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Steven Sun <StevenSun2021 at hotmail dot com> ---
I look at the call stack. Most of the time is wasted on `dump_template_parms`
in `gcc/cp/error.c`. I commented several functions calling it:

(I'm using stage-1 compiler)

`announce_function` in `gcc/toplev.c`
`push_tinst_level_loc` in `gcc/cp/pt.c`
`cp_printer` in `gcc/cp/error.c` (directly return true)

Then I got the output after a few seconds.

----------------------
examples/../include/./model.hpp: In instantiation of ‘’:
examples/../include/./model.hpp:55:147:   required from ‘’
examples/../include/./model.hpp:61:77:   required from ‘’
examples/../include/./model.hpp:55:147:   [ skipping 8 instantiation contexts,
use -ftemplate-backtrace-limit=0 to disable ]
examples/../include/./model.hpp:55:147:   required from ‘’
examples/../include/./model.hpp:55:147:   recursively required from ‘’
examples/../include/./model.hpp:55:147:   required from ‘’
examples/../include/./model.hpp:60:77:   required from ‘’
examples/../include/./model.hpp:60:77:   recursively required from ‘’
examples/../include/./model.hpp:55:147:   recursively required from ‘’
examples/../include/./model.hpp:55:147:   required from ‘’
examples/../include/./model.hpp:55:147:   recursively required from ‘’
examples/../include/./model.hpp:55:147:   required from ‘’
examples/../include/./model.hpp:60:77:   required from ‘’
examples/../include/./model.hpp:55:147:   required from ‘’
examples/../include/./model.hpp:382:55:   required from ‘’
examples/dcgan.cc:48:43:   required from here
examples/../include/./model.hpp:59:96: error: ‘’ has no member named ‘’
----------------------

But I cannot give the output. Because the dumping process will lead to an out
of memory.



If I disable member access check, it gives an error
---------------------
examples/../include/./model.hpp: In instantiation of ‘’:
examples/../include/./model.hpp:55:147:   recursively required from ‘’
examples/../include/./model.hpp:55:147:   required from ‘’
examples/../include/./model.hpp:60:77:   required from ‘’
examples/../include/./model.hpp:55:147:   required from ‘’
examples/../include/./model.hpp:382:55:   required from ‘’
examples/dcgan.cc:48:43:   required from here
examples/../include/./model.hpp:60:77: error: use of ‘’ before deduction of
‘auto’
--------------------
It's the same source location!

and it is in your definition of 
--------------------
 template< Expression Ex, Place_Holder Ph, Expression Ey >
  auto replace_placeholder_with_expression( Ex const& ex, Ph const&
old_place_holder, Ey const& new_expression )
--------------------

  reply	other threads:[~2021-06-03  3:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 15:19 [Bug c++/100877] New: " wang_feng at live dot com
2021-06-03  3:36 ` StevenSun2021 at hotmail dot com [this message]
2021-06-03  3:58 ` [Bug c++/100877] " StevenSun2021 at hotmail dot com
2021-06-03  9:48 ` wang_feng at live dot com
2021-06-03 12:02 ` redi at gcc dot gnu.org

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-100877-4-D6XJyeVGRD@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).