public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincent.lextrait at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/100299] New: cc1plus taking all RAM
Date: Wed, 28 Apr 2021 00:29:06 +0000	[thread overview]
Message-ID: <bug-100299-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 100299
           Summary: cc1plus taking all RAM
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent.lextrait at gmail dot com
  Target Milestone: ---

Created attachment 50692
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50692&action=edit
ii file to reproduce the issue. gunzip first.

While compiling a relatively large file (ii file ~2 MB), g++ compilation in -O3
aborts after suddenly allocating in a few steps within a few seconds all the
RAM (128 GB!).

Compiles just fine with -O2 (and it takes 5 times longer than to abort in -O3).

To my utter surprise, it compiles with -O2 -fgcse-after-reload -fipa-cp-clone
-floop-interchange -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
-fsplit-loops -fsplit-paths -ftree-loop-distribution -ftree-loop-vectorize
-ftree-partial-pre -ftree-slp-vectorize -funswitch-loops -fvect-cost-model
-fvect-cost-model=dynamic -fversion-loops-for-strides

While the specific 11.1 man specifies that these options are equivalent to -O3.
Excerpt of man:

-O3 Optimize yet more.  -O3 turns on all optimizations specified by -O2 and
also turns on the following optimization flags:

           -fgcse-after-reload -fipa-cp-clone -floop-interchange
-floop-unroll-and-jam -fpeel-loops -fpredictive-commoning -fsplit-loops
           -fsplit-paths -ftree-loop-distribution -ftree-loop-vectorize
-ftree-partial-pre -ftree-slp-vectorize -funswitch-loops
           -fvect-cost-model -fvect-cost-model=dynamic
-fversion-loops-for-strides

The man must not be correct, some other option must be added in -O3.

I am on x86_64-linux-gnu (Ubuntu 20.04) - but I am fairly sure it is not
platform-dependent.

gcc is configured using 

./configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu --prefix=/usr/local/gcc-11.1
--enable-checking=release --enable-languages=c,c++ --disable-multilib
--program-suffix=-11.1

The complete command line that triggers the bug:

g++-11.1 -std=c++20 -O3 -c test.ii

The error:

g++-11.1: fatal error: Killed signal terminated program cc1plus
compilation terminated.

gzipped test.ii attached to this bug report.

Previous versions of gcc do not exhibit the bug, but do compile very very
slowly compared to -O0 option, or compared to clang.

             reply	other threads:[~2021-04-28  0:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28  0:29 vincent.lextrait at gmail dot com [this message]
2021-04-28  6:20 ` [Bug c++/100299] [11/12 Regression] cc1plus taking all RAM in EVRP rguenth at gcc dot gnu.org
2021-05-10 16:46 ` [Bug tree-optimization/100299] " jason at gcc dot gnu.org
2021-06-07 22:13 ` amacleod at redhat dot com
2021-06-08  8:15 ` [Bug tree-optimization/100299] [11 " rguenth at gcc dot gnu.org
2021-07-14 21:58 ` cvs-commit at gcc dot gnu.org
2021-07-14 22:17 ` amacleod at redhat dot com

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-100299-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).