public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "iamanonymous.cs at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/114858] New: Compilation Hang and Excessive RAM Consumption in GCC
Date: Fri, 26 Apr 2024 01:49:06 +0000	[thread overview]
Message-ID: <bug-114858-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 114858
           Summary: Compilation Hang and Excessive RAM Consumption in GCC
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

The following code snippet triggers a hang issue:
============================================
$ cat bug.cpp

template <class F> void g(F);
template <class... A>
auto h(A &&... a) -> decltype(g(0,
(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype(g<decltype()>)(a)...))
{
  h([] {});
}

int main() { 
  h(); 
  return 0; 
}
============================================
I observed that when attempting to compile this code using GCC, the compilation
process hangs indefinitely, without providing any output or indicating
successful compilation. Additionally, the RAM usage continuously increases,
leading to excessive consumption of system resources.

However, it is worth noting that when using LLVM as the compiler, the code
compiles quickly and produces the expected compilation output.

We have found that this issue still persists in the latest version of GCC(see
https://godbolt.org/z/P1c7f664f)

The command we used is(no error output):
============================================
g++ bug.cpp
============================================


The GCC version:
============================================
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/cTest/gcc/myinstall/libexec/gcc/x86_64-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../configure -v --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --enable-checking=no
--enable-languages=c,c++ --disable-multilib --prefix=/home/cTest/gcc/myinstall
--disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240329 (experimental) (GCC) 
============================================

             reply	other threads:[~2024-04-26  1:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26  1:49 iamanonymous.cs at gmail dot com [this message]
2024-04-26  1:55 ` [Bug c++/114858] [11/12/13/14 regression] " pinskia at gcc dot gnu.org
2024-04-26  1:56 ` [Bug c++/114858] [11/12/13/14 regression] Compilation Hang and Excessive RAM Consumption in GCC with invalid input pinskia at gcc dot gnu.org
2024-04-26  7:22 ` [Bug c++/114858] [11/12/13/14 regression] Compilation Hang and Excessive RAM Consumption in GCC with invalid input since r0-128725 jakub at gcc dot gnu.org
2024-04-28  1:55 ` [Bug c++/114858] [11/12/13/14/15 " hp 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-114858-4@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).