On Thu, Oct 23, 2014 at 02:34:04PM +0200, Marek Polacek wrote: > The issue here was that we were diagnosing an artificial check > that we created within the scope of shift instrumentation. In > other words, for shifts we create something like > (unsigned) A >> (B - C) and signed-integer-overflow triggered > on that subtraction. Fixed by making the subtraction work on > unsigned types. This only happened in C99/C++11 mode. > Middle end seems to cope well with RSHIFT_EXPR whose second op > has an unsigned type. > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > 2014-10-23 Marek Polacek <pola...@redhat.com> > > * c-ubsan.c (ubsan_instrument_shift): Perform the MINUS_EXPR > in unsigned type. > > * c-c++-common/ubsan/undefined-2.c: New test.
Ok. Can you please queue it for 4.9 branch too, after 4.9.2 is released? There is no -f*sanitize-recover* support, but it can be supposedly left out from dg-options for the branch. Jakub