[Bug c++/28543] New: Usage of -ftemplate-depth- may cause segfault
dushistov at mail dot ru
gcc-bugzilla@gcc.gnu.org
Sun Jul 30 09:37:00 GMT 2006
$ cat fac.cpp
#include <cstdio>
template <unsigned int n> struct f;
template<> struct f<0> { enum { value = 1 }; };
template<> struct f<1> { enum { value = 1 }; };
template <unsigned int n> struct f { enum { value = n * f<n - 1>::value }; };
int main()
{
printf("%u\n", f<-10>::value);
return 0;
}
$ LANG=en_EN g++ -ftemplate-depth-10000 fac.cpp
g++: Internal error: Segmentation fault (program cc1plus)
--
Summary: Usage of -ftemplate-depth- may cause segfault
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dushistov at mail dot ru
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28543
More information about the Gcc-bugs
mailing list