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 4/5] Disable -fcheck-pointer-bounds with sanitizers.


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


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