From 5843a5f0a2d875ac67b098e6a8eae0501e31fe16 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 13 Jun 2016 09:17:16 +0200 Subject: [PATCH] Do not enable -fcheck-pointer-bounds w/ -fsanitize=bounds PR sanitizer/71458 * toplev.c (process_options): Do not enable -fcheck-pointer-bounds w/ -fsanitize=bounds. * gcc.target/i386/pr71458.c: New test. From-SVN: r237353 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/i386/pr71458.c | 7 +++++++ gcc/toplev.c | 9 +++++++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr71458.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c2f2a0b88ea..3ea7a014f5a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-06-13 Martin Liska + + PR sanitizer/71458 + * toplev.c (process_options): Do not enable -fcheck-pointer-bounds + w/ -fsanitize=bounds. + 2016-06-12 Uros Bizjak * config/i386/i386.c (ix86_init_builtins): Calculate diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 426c8ad1865..f3245154d77 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-06-13 Martin Liska + + * gcc.target/i386/pr71458.c: New test. + 2016-06-12 Uros Bizjak PR target/71241 diff --git a/gcc/testsuite/gcc.target/i386/pr71458.c b/gcc/testsuite/gcc.target/i386/pr71458.c new file mode 100644 index 00000000000..27e7764b5a0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr71458.c @@ -0,0 +1,7 @@ +/* { 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 } */ + +enum {} a[0]; +void fn1(int); +void fn2() { fn1(a[-1]); } diff --git a/gcc/toplev.c b/gcc/toplev.c index 543b8a3dc72..f51d2cb2b77 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1276,6 +1276,15 @@ process_options (void) "Address Sanitizer"); flag_check_pointer_bounds = 0; } + + 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