This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/28543] New: Usage of -ftemplate-depth- may cause segfault
- From: "dushistov at mail dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jul 2006 09:37:38 -0000
- Subject: [Bug c++/28543] New: Usage of -ftemplate-depth- may cause segfault
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
$ 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