https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80290
Bug ID: 80290 Summary: g++ uses unreasonable amount of memory compiling nested string maps Product: gcc Version: 7.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: andrew at aj dot id.au Target Milestone: --- Created attachment 41107 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41107&action=edit Source file demonstrating bad behaviour g++ uses an unreasonable amount of memory (greater than 5GB) when compiling the attached code. A source archive is attached, and the test can be run with `make`. Testing suggests this issue occurs with x86_64 g++s 5.4 and 6.2 from Ubuntu Yakkety, and both 6.3 and 7.0.1 built from source. The bug was originally encountered under a Yocto/Poky build cross-compiling from x86_64 to ARMv6 (targeting an ARM1176 core). Alan Modra's tests indicate g++ 4.8 performs better than any of the previously mentioned versions. Behaviour in clang 3.8 also appears reasonable. GCCs built from source were built with a configure line derived from Ubuntu Yakkety's g++ builds, with minor modifications to restrict the supported languages and architectures, and to change prefixes. Test case is built with `g++ -std=c++11 fru-gen.ii -o fru-gen.o` $ ~/gcc/master/bin/g++ -v Using built-in specs. COLLECT_GCC=/home/andrew/gcc/master/bin/g++ COLLECT_LTO_WRAPPER=/home/andrew/gcc/master/libexec/gcc/x86_64-linux-gnu/7.0.1/lto-wrapper Target: x86_64-linux-gnu Configured with: ../configure -v --enable-languages=c,c++ --prefix=/home/andrew/gcc/master --enable-shared --enable-linker-build-id --without-included-gettext --enable-threads=posix --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-gtk-cairo --with-arch-directory=amd64 --disable-werror --disable-multilib --with-abi=m64 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --enable-bootstrap Thread model: posix gcc version 7.0.1 20170401 (experimental) (GCC)