From 3828bb0d7ed18e03d0794c0a38a51d155421559c Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 9 Mar 2017 11:04:50 +0100 Subject: [PATCH] Disable -fcheck-pointer-bounds with sanitizers. 2017-03-09 Martin Liska PR target/65705 PR target/69804 * toplev.c (process_options): Disable -fcheck-pointer-bounds with sanitizers. 2017-03-09 Martin Liska PR target/65705 PR target/69804 * gcc.target/i386/pr71458.c: Update scanned pattern. From-SVN: r245997 --- gcc/ChangeLog | 7 ++++++ gcc/testsuite/ChangeLog | 6 +++++ gcc/testsuite/gcc.target/i386/pr71458.c | 2 +- gcc/toplev.c | 32 +++++++++++++++---------- 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 006052bad27..33670abf0f2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-03-09 Martin Liska + + PR target/65705 + PR target/69804 + * toplev.c (process_options): Disable -fcheck-pointer-bounds with + sanitizers. + 2017-03-09 Marek Polacek PR c++/79672 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 840eb1d26a7..e31735b3391 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-03-09 Martin Liska + + PR target/65705 + PR target/69804 + * gcc.target/i386/pr71458.c: Update scanned pattern. + 2017-03-09 Marek Polacek PR c++/79672 diff --git a/gcc/testsuite/gcc.target/i386/pr71458.c b/gcc/testsuite/gcc.target/i386/pr71458.c index 27e7764b5a0..2faf6bb9391 100644 --- a/gcc/testsuite/gcc.target/i386/pr71458.c +++ b/gcc/testsuite/gcc.target/i386/pr71458.c @@ -1,6 +1,6 @@ /* { dg-do compile { target { ! x32 } } } */ /* { dg-options "-fcheck-pointer-bounds -mmpx -fsanitize=bounds" } */ -/* { dg-error "-fcheck-pointer-bounds is not supported with -fsanitize=bounds" "" { target *-*-* } 0 } */ +/* { dg-error "-fcheck-pointer-bounds is not supported with Undefined Behavior Sanitizer" "" { target *-*-* } 0 } */ enum {} a[0]; void fn1(int); diff --git a/gcc/toplev.c b/gcc/toplev.c index beb581aba55..6a7e4fbdffb 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1274,22 +1274,30 @@ process_options (void) flag_check_pointer_bounds = 0; } - if (flag_sanitize & SANITIZE_ADDRESS) + if (flag_sanitize) { - error_at (UNKNOWN_LOCATION, - "-fcheck-pointer-bounds is not supported with " - "Address Sanitizer"); - flag_check_pointer_bounds = 0; - } + if (flag_sanitize & SANITIZE_ADDRESS) + error_at (UNKNOWN_LOCATION, + "-fcheck-pointer-bounds is not supported with " + "Address Sanitizer"); + + if (flag_sanitize & (SANITIZE_UNDEFINED | SANITIZE_NONDEFAULT)) + error_at (UNKNOWN_LOCATION, + "-fcheck-pointer-bounds is not supported with " + "Undefined Behavior Sanitizer"); + + if (flag_sanitize & SANITIZE_LEAK) + error_at (UNKNOWN_LOCATION, + "-fcheck-pointer-bounds is not supported with " + "Leak Sanitizer"); + + if (flag_sanitize & SANITIZE_THREAD) + error_at (UNKNOWN_LOCATION, + "-fcheck-pointer-bounds is not supported with " + "Thread Sanitizer"); - if (flag_sanitize & SANITIZE_BOUNDS) - { - error_at (UNKNOWN_LOCATION, - "-fcheck-pointer-bounds is not supported with " - "-fsanitize=bounds"); flag_check_pointer_bounds = 0; } - } /* One region RA really helps to decrease the code size. */ -- 2.30.2