https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93892
Bug ID: 93892
Summary: Aggregate initialisation of std::array<nontrivial,
large> takes forever to compile
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: zoid at riseup dot net
Target Milestone: ---
Created attachment 47890
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47890&action=edit
preprocessed mwe
Aggregate initialisation of a std::array with a non-trivial type and a large
number of elements, say 100000, takes ages to compile and produces
correspondingly huge binaries on any optimisation level. Cranking up the size
parameter exacerbates the problem.
Note: There are similar bug reports of very old versions of gcc. This might be
a regression.
Minimal working example:
#include <array>
int main() {
struct nontriv { nontriv() { } };
std::array<nontriv,100000> array = {}; // <- aggregate init
}
// g++ -Wall -Wextra -pedantic -std=c++17 -O1 mwe.cpp -save-temps -v
Attached mwe.ii of the above mwe.cpp.
g++ version information:
Configured with: ../src/configure -v --with-pkgversion='Debian 9.2.1-25'
--with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-9
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none,hsa --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean
--enable-link-mutex
Thread model: posix
gcc version 9.2.1 20200123 (Debian 9.2.1-25)