https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65042
Bug ID: 65042 Summary: gcc5 has a template depth problem that was fine in gcc4 Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: karl at kleinpaste dot org Created attachment 34740 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34740&action=edit class description employing layered string- and int-indexed maps-within-maps Attached is modulecache.hh, part of Xiphos, which was recently involved in a Fedora gcc5 mass rebuild test for upcoming Fedora 22. This file exhibits a template complaint regarding nested std::map usage. The nesting provides an intuitive access to data content by allowing subscripting at any map level to obtain all subordinate content. The plain fact is that this code has been compiling in gcc4 since approximately 2008. It was then found that using -ftemplate-depth=128 makes the gcc5 compilation survive, but I don't see why this should be necessary, considering that the code has been fine for 7 years preceding, without use of any such modifiers. Has the default depth limit changed in gcc5? FYI recommended to file this report by an involved Fedora engineer; I am Xiphos project admin. In file included from /usr/include/c++/5.0.0/map:60:0, from ../src/main/modulecache.hh:45, from ../src/main/modulecache.cc:30: /usr/include/c++/5.0.0/bits/stl_tree.h: In instantiation of 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_destroy_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = int; _Val = std::pair<const int, ModuleCache::CacheVerse>; _KeyOfValue = std::_Select1st<std::pair<const int, ModuleCache::CacheVerse> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, ModuleCache::CacheVerse> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const int, ModuleCache::CacheVerse> >*]': /usr/include/c++/5.0.0/bits/stl_tree.h:562:17: required from 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_drop_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = int; _Val = std::pair<const int, ModuleCache::CacheVerse>; _KeyOfValue = std::_Select1st<std::pair<const int, ModuleCache::CacheVerse> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, ModuleCache::CacheVerse> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const int, ModuleCache::CacheVerse> >*]' /usr/include/c++/5.0.0/bits/stl_tree.h:1493:16: required from 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_erase(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = int; _Val = std::pair<const int, ModuleCache::CacheVerse>; _KeyOfValue = std::_Select1st<std::pair<const int, ModuleCache::CacheVerse> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, ModuleCache::CacheVerse> >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const int, ModuleCache::CacheVerse> >*]' /usr/include/c++/5.0.0/bits/stl_tree.h:859:17: required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::~_Rb_tree() [with _Key = int; _Val = std::pair<const int, ModuleCache::CacheVerse>; _KeyOfValue = std::_Select1st<std::pair<const int, ModuleCache::CacheVerse> >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, ModuleCache::CacheVerse> >]' /usr/include/c++/5.0.0/bits/stl_map.h:96:11: required from 'void __gnu_cxx::new_allocator<_Tp>::destroy(__gnu_cxx::new_allocator<_Tp>::pointer) [with _Tp = std::pair<const int, std::map<int, ModuleCache::CacheVerse> >; __gnu_cxx::new_allocator<_Tp>::pointer = std::pair<const int, std::map<int, ModuleCache::CacheVerse> >*]' /usr/include/c++/5.0.0/bits/stl_tree.h:521:9: required from 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_destroy_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = int; _Val = std::pair<const int, std::map<int, ModuleCache::CacheVerse> >; _KeyOfValue = std::_Select1st<std::pair<const int, std::map<int, ModuleCache::CacheVerse> > >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, std::map<int, ModuleCache::CacheVerse> > >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const int, std::map<int, ModuleCache::CacheVerse> > >*]' /usr/include/c++/5.0.0/bits/stl_tree.h:562:17: [ skipping 14 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ] /usr/include/c++/5.0.0/bits/stl_tree.h:521:9: required from 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_destroy_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = const std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > >; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >; _Compare = std::less<const std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >*]' /usr/include/c++/5.0.0/bits/stl_tree.h:562:17: required from 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_drop_node(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = const std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > >; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >; _Compare = std::less<const std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >*]' /usr/include/c++/5.0.0/bits/stl_tree.h:1493:16: required from 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_erase(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = const std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > >; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >; _Compare = std::less<const std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >*]' /usr/include/c++/5.0.0/bits/stl_tree.h:859:17: required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::~_Rb_tree() [with _Key = const std::basic_string<char>; _Val = std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > >; _KeyOfValue = std::_Select1st<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >; _Compare = std::less<const std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >]' /usr/include/c++/5.0.0/bits/stl_map.h:163:14: required from 'std::map<_Key, _Tp, _Compare, _Alloc>::map() [with _Key = const std::basic_string<char>; _Tp = std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > >; _Compare = std::less<const std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::map<int, std::map<int, std::map<int, std::map<int, ModuleCache::CacheVerse> > > > > >]' ../src/main/modulecache.cc:34:23: required from here /usr/include/c++/5.0.0/bits/stl_tree.h:521:22: fatal error: template instantiation depth exceeds maximum of 25 (use -ftemplate-depth= to increase the maximum) { get_allocator().destroy(__p->_M_valptr()); } ^