https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79416
Bug ID: 79416 Summary: Internal compiler error for recursive template expansion Product: gcc Version: 5.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mini at cs dot technion.ac.il Target Milestone: --- Target: x86_64-linux-gnu gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) I ran it about 10 times. 9 times I got this output: $ g++ prog.cpp g++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions. I got this output 1 time: $ g++ prog.cpp cc1plus: out of memory allocating 268435144 bytes after a total of 101212160 bytes to reproduce: $ cat prog.cpp template <int N> void nops() __attribute((always_inline)); template <int N> void more_nops() __attribute((always_inline)); template <int N> inline void nops() { asm("nop"); nops<N - 1>(); } template<> inline void nops<0>() { }; template <int N> inline void more_nops() { nops<800>(); more_nops<N - 1>(); }; template<> inline void more_nops<0>() { }; int main() { more_nops<300>(); } $ g++ prog.cpp