https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66292
Bug ID: 66292 Summary: ICE in constexpr call evaluation Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: colu...@gmx-topmail.de Target Milestone: --- When compiling Testing.cxx from https://github.com/Arcoth/Constainer/blob/9a96ba3089778fe655fde2334701077e2d6c8f35/Testing.cxx#L91, GCC bails out at the end: /home/arcoth/Programming/Constainer/Testing.cxx:91:41: in constexpr expansion of »Constainer::strToInt<int>(((const char*)" 6849."), 0u, 10)« /home/arcoth/Programming/Constainer/Parser.hxx:156:22: in constexpr expansion of »Constainer::strToInt<int>(str, Constainer::CharTraits<Char>::length<char>(str), pos, base)« /home/arcoth/Programming/Constainer/Parser.hxx:143:25: in constexpr expansion of »Constainer::strToInt<int, const char*>(str, (str + ((sizetype)len)), ret, base)« /home/arcoth/Programming/Constainer/Testing.cxx:91:55: in constexpr expansion of »Constainer::BasicString<char, 256ul>(((const char*)"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"))« /home/arcoth/Programming/Constainer/String.hxx:179:9: in constexpr expansion of »Constainer::BasicString<Char, MaxN, Traits>::append<char, 256ul, Constainer::CharTraits<char> >(str)« /home/arcoth/Programming/Constainer/String.hxx:292:16: in constexpr expansion of »Constainer::BasicString<Char, MaxN, Traits>::append<char, 256ul, Constainer::CharTraits<char> >(str, Constainer::CharTraits<Char>::length<char>(str))« /home/arcoth/Programming/Constainer/String.hxx:277:47: in constexpr expansion of »Constainer::BasicString<Char, MaxN, Traits>::insert<char, 256ul, Constainer::CharTraits<char> >(((Constainer::BasicString<char, 256ul>*)this)->Constainer::BasicString<char, 256ul>::<anonymous>.Constainer::detail::BasicVector<T, MaxN, CopyTraits, addBufferSize>::size<char, 256ul, Constainer::CharTraits<char>, 1ul>(), str, len)« /home/arcoth/Programming/Constainer/String.hxx:235:3: in constexpr expansion of »((Constainer::BasicString<char, 256ul>*)this)->Constainer::BasicString<char, 256ul>::<anonymous>.Constainer::detail::BasicVector<T, MaxN, CopyTraits, addBufferSize>::_createInsertionSpace<char, 256ul, Constainer::CharTraits<char>, 1ul>((((Constainer::Array<char, 257ul>::const_iterator)((Constainer::BasicString<char, 256ul>*)this)->Constainer::BasicString<char, 256ul>::<anonymous>.Constainer::detail::BasicVector<char, 256ul, Constainer::CharTraits<char>, 1ul>::<anonymous>.Constainer::Array<T, Size>::begin<char, 257ul>()) + ((sizetype)index)), len)« /home/arcoth/Programming/Constainer/Vector.hxx:83:9: in constexpr expansion of »Constainer::Assert((((const value_type*)Constainer::detail::BasicVector<T, MaxN, CopyTraits, addBufferSize>::end<char, 256ul, Constainer::CharTraits<char>, 1ul>()) >= pos), 0u)« /home/arcoth/Programming/Constainer/Testing.cxx:91:55: interner Compiler-Fehler: Speicherzugriffsfehler static_assert( Constainer::strToInt<int>(" 6849.") == 6849 ); ^ 0xc8bd7f crash_signal ../.././gcc/toplev.c:380 0x9f8444 bool vec_safe_reserve<tree_node*, va_gc>(vec<tree_node*, va_gc, vl_embed>*&, unsigned int, bool) ../.././gcc/vec.h:575 0x9f8444 tree_node** vec_safe_push<tree_node*, va_gc>(vec<tree_node*, va_gc, vl_embed>*&, tree_node* const&) ../.././gcc/vec.h:669 0x9f8444 add_local_decl(function*, tree_node*) ../.././gcc/function.c:6705 0xcfce86 remap_decls ../.././gcc/tree-inline.c:653 0xcfea30 remap_block ../.././gcc/tree-inline.c:721 0xcff7e8 copy_bind_expr ../.././gcc/tree-inline.c:794 0xcff7e8 copy_tree_body_r(tree_node**, int*, void*) ../.././gcc/tree-inline.c:1128 0xf0e5a2 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, default_hashset_traits>*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, default_hashset_traits>*)) ../.././gcc/tree.c:11117 0xcf68ef copy_tree_body ../.././gcc/tree-inline.c:2964 0xcfd31e copy_fn(tree_node*, tree_node*&, tree_node*&) ../.././gcc/tree-inline.c:5994 0x7cedc6 cxx_eval_call_expression ../.././gcc/cp/constexpr.c:1347 0x7cfff4 cxx_eval_constant_expression ../.././gcc/cp/constexpr.c:3062 0x7d0c47 cxx_eval_conditional_expression ../.././gcc/cp/constexpr.c:1648 0x7d0c47 cxx_eval_constant_expression ../.././gcc/cp/constexpr.c:3353 0x7d0c47 cxx_eval_conditional_expression ../.././gcc/cp/constexpr.c:1648 0x7d0c47 cxx_eval_constant_expression ../.././gcc/cp/constexpr.c:3353 0x7d5855 cxx_eval_statement_list ../.././gcc/cp/constexpr.c:2853 0x7d0c07 cxx_eval_constant_expression ../.././gcc/cp/constexpr.c:3425 0x7cf0c3 cxx_eval_call_expression ../.././gcc/cp/constexpr.c:1377 I can currently not be asked to boil the example down, since it emerges from a fairly large project. However, I can confirm this in trunk v. 20150502.