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] Do not sanitize left shifts for -fwrapv (PR68418)


On 12/04/2015 01:48 PM, Paolo Bonzini wrote:

gcc:
	PR sanitizer/68418
	* c-family/c-ubsan.c (ubsan_instrument_shift): Disable
	sanitization of left shifts for wrapping signed types as well.

gcc/testsuite:
	PR sanitizer/68418
	* gcc.dg/ubsan/c99-wrapv-shift-1.c,
	gcc.dg/ubsan/c99-wrapv-shift-2.c: New testcases.
Doesn't this change how pointer types are handled?

Why would pointer types be shifted at all (at the ubsan level,
which is basically the AST)?
It's not really a question of why, it's a change in behaviour. Previously this code would emit instrumentation objects of pointer type if pointers are signed on the target. After your change it will not, in fact, it may trigger a checking failure.

So you'd have to argue that we don't care about sanitization of these operations on pointers and verify that we don't trigger a checking failure. I'm really not the best judge of whether or not we want to instrument pointer shifts -- they're not terribly useful in general, but I'm always [un]pleasantly surprised at what people actually do.


Jeff


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