On Fri, Jul 25, 2014 at 04:41:08PM -0400, Jason Merrill wrote:
On 07/04/2014 04:47 PM, Jakub Jelinek wrote:
(ubsan_expand_null_ifn): ...take type from ckind argument's type rather than
first argument.
Why? It looks like they have the same type with your patch, and then you
need to convert ckind back to unsigned char.
Because right now (almost?) all type conversions are useless, therefore
the middle-end happily replaces e.g.
// _11 has void * type
_12 = (int *) _11;
UBSAN_NULL (_12, ...);
with
UBSAN_NULL (_11, ...);
and the type will be lost there. If the type is put on a constant (it is
the same thing as e.g. MEM_REF puts the pointer type on the offset
constant), then nothing will change it.