https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100807
Bug ID: 100807 Summary: initialization of global struct with large array leads to huge assembly Product: gcc Version: 11.1.0 Status: UNCONFIRMED Keywords: compile-time-hog Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sbence92 at gmail dot com Target Milestone: --- Host: x86_64-w64-mingw32, x86_64-linux-gnu Target: x86_64-w64-mingw32, x86_64-linux-gnu Build: x86_64-w64-mingw32, x86_64-linux-gnu The below is a reduced version of a file that took 33 minutes(!) to compile, cc1 starting from 1GB of memory usage, reaching 2GB eventually. This example takes ~12 seconds, ~700 MB of memory and generates 14MB of assembly as gcc unrolls the constructor calls even with O0 and crashes with O1 and above. clang and icc is fine, they do this with a loop, msvc kindof the same. This seems to be and old issue, even gcc 4 timeouts on godbolt. struct B { B() {} }; struct A { B b[128][1875]; }; A a{};