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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Henry from comment #3)
> So far that single line is the only place in all libstdc++ that triggers
> that undefined. 

No it isn't, we "fixed" another one a few days ago, in perfectly correct code,
just to silence this stupid sanitizer.


> I cannot believe that a developer consciously chose to let unsigned
> underflow happen in such simple expression.

You're wrong, twice. The behaviour of that code is intentional, and there is no
underflow. Unsigned integers cannot underflow or overflow, by definition. They
are defined to wrap around with modulus arithmetic, which is exactly the
behaviour desired for Mersenne twister (and most other PRNGs). If you want
modulus arithmetic and unsigned integers have modulus arithmetic, relying on
that makes perfect sense.

This sanitizer is stupid.

Reply via email to