[Bug c++/79416] [5/6/7 Regression] Internal compiler error for recursive template expansion

mini at cs dot technion.ac.il gcc-bugzilla@gcc.gnu.org
Wed Feb 8 09:47:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79416

--- Comment #2 from Marina Minkin <mini at cs dot technion.ac.il> ---
I was able to get a different error on gcc 4.4.7

$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
$ cat prog.cpp
template <int N>
void nops() __attribute((always_inline));

template <int N>
void more_nops() __attribute((always_inline));

template <int N>
void more_nops2() __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<400>();
        more_nops<N - 1>();
};

template<>
inline void more_nops<0>()
{
};

template <int N>
inline void more_nops2()
{
        more_nops<400>();
        more_nops2<N - 1>();
};

template<>
inline void more_nops2<0>()
{
};


int main() {
        more_nops2<100>();
}

$ g++ prog.cpp
virtual memory exhausted: Cannot allocate memory


More information about the Gcc-bugs mailing list