[Bug c++/86503] Segmentation fault signal terminated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86503 Andrew Pinski changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX --- Comment #4 from Andrew Pinski --- >-ftemplate-depth=100 This is not a bug, the whole point of template-depth is to prevent the crashes like this from happening. Anyways clang on the trunk says: :15:9: warning: stack nearly exhausted; compilation time may suffer, and crashes due to stack overflow are likely [-Wstack-exhausted] typeof( ft< F, n-1 >( F(), 0 ) ) ^ ... :15:9: fatal error: recursive template instantiation exceeded maximum depth of 1024 typeof( ft< F, n-1 >( F(), 0 ) ) ^
[Bug c++/86503] Segmentation fault signal terminated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86503 Jonathan Wakely changed: What|Removed |Added Keywords||rejects-valid Status|UNCONFIRMED |NEW Last reconfirmed||2018-08-09 Ever confirmed|0 |1
[Bug c++/86503] Segmentation fault signal terminated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86503 --- Comment #3 from zhonghao at pku dot org.cn --- (In reply to Richard Biener from comment #1) > You run out of memory or stack. Try ulimit -s unlimited I tried ulimit -s unlimited. This time, the error messages are as follows: g++ -ftemplate-depth=100 test.cpp test.cpp: In substitution of 'template __typeof__ (ft(F(), 0)) ft(F, typename enable_if<(n != 0), int>::type) [with F = main()::a*; int n = -97]': test.cpp:14:21: recursively required by substitution of 'template __typeof__ (ft(F(), 0)) ft(F, typename enable_if<(n != 0), int>::type) [with F = main()::a*; int n = 1]' test.cpp:14:21: required by substitution of 'template __typeof__ (ft(F(), 0)) ft(F, typename enable_if<(n != 0), int>::type) [with F = main()::a*; int n = 2]' test.cpp:18:30: required from here test.cpp:14:21: fatal error: template instantiation depth exceeds maximum of 100 (use -ftemplate-depth= to increase the maximum) typeof( ft< F, n-1 >( F(), 0 ) ) ~~^~~~ compilation terminated.
[Bug c++/86503] Segmentation fault signal terminated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86503 --- Comment #2 from Jonathan Wakely --- (In reply to Richard Biener from comment #1) > You run out of memory or stack. Try ulimit -s unlimited Yes but that seems to be because GCC goes into an infinte recursive instantiation, which it shouldn't do.
[Bug c++/86503] Segmentation fault signal terminated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86503 --- Comment #1 from Richard Biener --- You run out of memory or stack. Try ulimit -s unlimited