On 11/03/14 13:47, Marek Polacek wrote:
We don't emit UBSAN_BOUNDS checks in case we can at compile-time
prove that the array access is fine.  Also if we have [i & CST],
where CST is <= bound_of_the_array, we know we're fine as well.

But we don't have similar BIT_AND_EXPR check for UBSAN_OBJECT_SIZE
which is what this patch attempts to add.
(This is unrelated to the UBSAN_NULL optimization I posted earlier
today.)

Bootstrap-ubsan/regtest passed on x86_64-linux, ok for trunk?

2014-11-03  Marek Polacek  <pola...@redhat.com>

        * ubsan.c (instrument_object_size): Optimize [x & CST] array accesses.
testsuite/
        * c-c++-common/ubsan/object-size-10.c: New test.
OK.
jeff

Reply via email to