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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Max Bruckner from comment #8)
> Nevertheless I disagree that there is no "overflow" or "underflow". It's a
> question of how you define the two words, in a way, but being defined
> doesn't make less of an underflow/overflow.
> 
> This is no bug, since std::align exhibits totally defined behavior, but I
> still think that having a runtime check for unsigned overflow is quite
> useful, because although it might not be undefined, it might still be
> unintended behavior in many cases.

I don't see how something like that can be ever useful.  unsigned integral
types don't have negative values, so if you want to sometimes subtract and
sometimes add some value, but the condition when that happens is done e.g. in
another function, you just use one of the operations and use negated numbers. 
That triggers this misdesigned sanitizer though of course.

Reply via email to