https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121143
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- That first loop corresponds to struct __distance_fn final { template<typename _It, sentinel_for<_It> _Sent> requires (!sized_sentinel_for<_Sent, _It>) constexpr iter_difference_t<_It> operator()[[nodiscard]](_It __first, _Sent __last) const { iter_difference_t<_It> __n = 0; while (__first != __last) { ++__first; ++__n; } return __n; } I think the caller is if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>) { const auto __sz = ranges::distance(__rg); if (__sz > (_Nm - size())) __throw_bad_alloc(); ranges::uninitialized_copy_n( ranges::begin(__rg), __sz, data() + _M_size, unreachable_sentinel); _M_size += size_type(__sz); } __throw_bad_alloc is indeed noreturn. loop->nb_iterations is 8 (because that __n aka __sz is 9), but new_i_bound is just 5.