public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "eisjmbjdfcukqlaely at nthrl dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105838] New: g++ 12.1.0 runs out of memory or time when building const std::vector of std::strings Date: Fri, 03 Jun 2022 16:22:49 +0000 [thread overview] Message-ID: <bug-105838-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105838 Bug ID: 105838 Summary: g++ 12.1.0 runs out of memory or time when building const std::vector of std::strings Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: eisjmbjdfcukqlaely at nthrl dot com Target Milestone: --- Created attachment 53078 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53078&action=edit Output of "g++ -E tmp_in.cpp > tmp_in.ii" While porting a Wordle-like game from an interpreted language to C++ (ironically, in an attempt at getting better performance from a compiled language!) it was found that g++ 12.1.0 cannot even initialize a const std::vector of known fixed-length words. Here is g++ 12.1.0 running out of memory (16GB RAM + 8GB swap) with -O1, after about a minute: ``` $ g++ tmp_in.cpp -O1 g++: fatal error: Killed signal terminated program cc1plus compilation terminated. ``` If optimization is disabled in an attempt to save memory, g++ takes unreasonably long and gets killed after 300 seconds: ``` $ timeout 300 g++ tmp_in.cpp # gets killed after 300 seconds with no a.out ``` Output of g++ -v: ``` $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --with-build-config=bootstrap-lto --enable-link-serialization=1 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.1.0 (GCC) ``` For comparison, here is clang++ 13.0.1 building in about 5 seconds without optimization: ``` $ /usr/bin/time --verbose clang++ tmp_in.cpp tmp_in.cpp:1797:19: warning: format specifies type 'int' but the argument has type 'std::vector::size_type' (aka 'unsigned long') [-Wformat] printf ("%d\n", lst.size()); ~~ ^~~~~~~~~~ %zu 1 warning generated. Command being timed: "clang++ tmp_in.cpp" User time (seconds): 4.69 System time (seconds): 0.17 $ ./a.out 21437 ``` If optimization is enabled with -O1, clang++ 13.0.1 still successfully compiles it, though it takes just over 2 minutes and almost 4GB RAM: ``` $ /usr/bin/time --verbose clang++ tmp_in.cpp -O1 tmp_in.cpp:1797:19: warning: format specifies type 'int' but the argument has type 'std::vector::size_type' (aka 'unsigned long') [-Wformat] printf ("%d\n", lst.size()); ~~ ^~~~~~~~~~ %zu 1 warning generated. Command being timed: "clang++ tmp_in.cpp -O1" User time (seconds): 125.31 System time (seconds): 0.81 Maximum resident set size (kbytes): 3675076 $ ./a.out 21437 ``` Output of clang++ -v for completeness: ``` clang++ -v clang version 13.0.1 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/12.1.0 Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.1.0 Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.1.0 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 ```
next reply other threads:[~2022-06-03 16:22 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-03 16:22 eisjmbjdfcukqlaely at nthrl dot com [this message] 2022-06-13 12:47 ` [Bug c++/105838] " rguenth at gcc dot gnu.org 2022-06-13 12:52 ` rguenth at gcc dot gnu.org 2022-06-14 11:56 ` rguenth at gcc dot gnu.org 2022-06-14 13:10 ` [Bug c++/105838] [10/11/12/13 Regression] " rguenth at gcc dot gnu.org 2022-06-14 13:11 ` rguenth at gcc dot gnu.org 2022-06-14 13:37 ` jakub at gcc dot gnu.org 2022-06-28 10:49 ` jakub at gcc dot gnu.org 2022-07-10 20:39 ` pinskia at gcc dot gnu.org 2022-07-11 15:43 ` luydorarko at vusra dot com 2022-12-05 17:57 ` jason at gcc dot gnu.org 2022-12-05 18:30 ` jakub at gcc dot gnu.org 2022-12-05 20:50 ` jason at gcc dot gnu.org 2022-12-05 20:58 ` jason at gcc dot gnu.org 2022-12-05 22:27 ` redi at gcc dot gnu.org 2022-12-05 22:34 ` jakub at gcc dot gnu.org 2022-12-05 23:57 ` jason at gcc dot gnu.org 2022-12-08 18:34 ` cvs-commit at gcc dot gnu.org 2022-12-08 18:41 ` cvs-commit at gcc dot gnu.org 2022-12-08 18:45 ` cvs-commit at gcc dot gnu.org 2022-12-15 5:26 ` cvs-commit at gcc dot gnu.org 2023-01-09 22:41 ` cvs-commit at gcc dot gnu.org 2023-06-02 15:01 ` [Bug c++/105838] [10/11/12/13/14 " cvs-commit at gcc dot gnu.org 2023-06-12 8:57 ` [Bug c++/105838] [10/11/12 " cvs-commit at gcc dot gnu.org 2023-07-07 10:43 ` [Bug c++/105838] [11/12 " rguenth at gcc dot gnu.org 2023-08-19 9:22 ` fxcoudert 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-105838-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: linkBe 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).