[RFC] Implement Undefined Behavior Sanitizer

Segher Boessenkool segher@kernel.crashing.org
Thu Jun 6 13:26:00 GMT 2013


> The C++11/C++14 undefined behavior of left signed shift can be tested
> similarly, if ((unsigned type for op0's type) op0) >> (precm1 - y)
> is greater than one, then it is undefined behavior.
> Jason, does
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/ 
> n3675.html#1457
> apply just to C++11/C++14, or to C++03 too?

Doesn't DR1457 also leave

    neg << 0

as undefined, where "neg" is a negative value?  That isn't caught by
your "greater than one" expression.


Segher



More information about the Gcc-patches mailing list