https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87680
Bug ID: 87680 Summary: Small program produces 400 meg .s file Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gnu at kosak dot com Target Milestone: --- This small program takes over a minute to compile and produces a 160 meg object file. sizeof(Bar) is large and it looks like the compiler wants to write down a precompiled version of it to the object file for the benefit of Bar's constructor. There are no static variables or anything like that so the object file really should be modest in size. % cat test.cc constexpr int size = 10000000; class Foo { int a = 10; int b = 11; int c = 12; int d = 13; }; class Bar { Foo foo[size]; }; void somefunc(const Bar *); int main() { Bar *bar = new Bar(); somefunc(bar); } % time g++ -O2 -c test.cc real 1m9.696s user 1m6.486s sys 0m2.806s % ls -l test.o -rw-rw-r-- 1 kosak kosak 160001760 Oct 22 01:41 test.o