https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61183
Bug ID: 61183
Summary: Large memory usage with smallish C++ templates (>
16GB)
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: giovannibajo at gmail dot com
I'm unable to compile the attached code with GCC 4.9.0, at -O0 even without -g,
because of RAM exhaustion (16GB). LLVM 3.4svn is able to compile the program in
about 2 minutes with a peak at 2GB (even at -O3 -g).
The code is actually quite small, and relies to template + always_inline to
basically generate large functions with 99% of dead code (can be proven dead
with some constant propagation). Probably being more aggressive in some early
pass (after early inlining) should fix the compilation problem.
Original code here for further analysys:
https://raw.githubusercontent.com/rasky/cz80/master/z80.cpp