This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] -fsanitize=alignment support
- From: Jason Merrill <jason at redhat dot com>
- To: Jakub Jelinek <jakub 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 17:30:16 -0400
- 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> <20140725212126 dot GF2397 at laptop dot redhat dot com>
On 07/25/2014 05:21 PM, Jakub Jelinek wrote:
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
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.
Makes sense, but please add a comment about it. OK with that change.