This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] -fsanitize=alignment support
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, "Joseph S. Myers" <joseph at codesourcery dot com>, Marek Polacek <polacek at redhat dot com>
- Date: Fri, 25 Jul 2014 23:21:26 +0200
- Subject: Re: [PATCH] -fsanitize=alignment support
- Authentication-results: sourceware.org; auth=none
- References: <20140704204719 dot GS31640 at tucnak dot redhat dot com> <53D2C0E4 dot 4080601 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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, ...);
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.