[PATCH 4/5] Disable -fcheck-pointer-bounds with sanitizers.

Martin Liška mliska@suse.cz
Thu Mar 9 10:02:00 GMT 2017


On 03/07/2017 05:21 PM, Jakub Jelinek wrote:
> On Mon, Mar 06, 2017 at 02:07:37PM +0100, marxin wrote:
>> 	PR target/65705
>> 	PR target/69804
>> 	* toplev.c (process_options): Disable -fcheck-pointer-bounds with
>> 	sanitizers.
> 
> I can understand why it is disabled for -fsanitize=address or
> -fsanitize=bounds, perhaps -fsanitize=threads too,
> but don't understand why e.g. -fsanitize=shift or -fsanitize=unreachable
> or -fsanitize=signed-integer-overflow or -fsanitize=leak (which is purely
> a linking option) should affect it.
> 
>> +      const char *sanitizer_names[] = { "Address", "Undefined Behavior",
>> +	"Leak", "Thread" };
>> +      const int sanitizer_flags[] = { SANITIZE_ADDRESS, SANITIZE_UNDEFINED,
>> +	SANITIZE_LEAK, SANITIZE_THREAD };
> 
> Even if there is a reason for that, there is also
> SANITIZE_NONDEFAULT that is part of UB sanitizer, so if you can't
> -fcheck-pointer-bounds with any parts of -fsanitize=undefined, then
> likely it applies to others too.
> For -fsanitize=bounds-stricts it surely applies though, if -fsanitize=bounds
> can't be MPX instrumented.
> 
>> +      for (unsigned i = 0; i < sizeof (sanitizer_flags) / sizeof (int); i++)
>> +	if (flag_sanitize & sanitizer_flags[i])
>> +	  {
>> +	    error_at (UNKNOWN_LOCATION,
>> +		      "-fcheck-pointer-bounds is not supported with "
>> +		      "%s Sanitizer", sanitizer_names[i]);
> 
> This is not i18n friendly, I think you just want to unroll the loop
> by hand and use 4 (or just 3?) different error_at calls.
> 
> 	Jakub
> 

Thanks for review, I fixed both in patch that I'm going to install.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Disable-fcheck-pointer-bounds-with-sanitizers.patch
Type: text/x-patch
Size: 2757 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170309/700abda7/attachment.bin>


More information about the Gcc-patches mailing list