public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100299] New: cc1plus taking all RAM
@ 2021-04-28  0:29 vincent.lextrait at gmail dot com
  2021-04-28  6:20 ` [Bug c++/100299] [11/12 Regression] cc1plus taking all RAM in EVRP rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vincent.lextrait at gmail dot com @ 2021-04-28  0:29 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-07-14 22:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28  0:29 [Bug c++/100299] New: cc1plus taking all RAM vincent.lextrait at gmail dot com
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

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