https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119429

--- Comment #27 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If it is easy, I guess we can live with it.
If you had say some function or template which would use unsigned type as
iterator, working around the lack of design would mean duplicating the code.
Consider e.g.
template <typename T, typename F>
void
foo (T s, T e, T i, F f)
{
  for (T x = s; x != e; x += i)
    f (x);
}
This works just fine for signed types and unsigned types as well, for the
latter iterating downwards is done by having very large i (say i = -1U).  This
doesn't work for -fsanitize=unsigned-integer-overflow because it will think it
is not valid and
you'll need to use -= in that case instead.

Reply via email to