This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] -fsanitize=alignment support


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
	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.

Makes sense, but please add a comment about it.  OK with that change.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]