From a04b8e09388499686aabd401ef33e2821f3f0809 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 9 Jun 2016 11:09:07 +0200
Subject: [PATCH] Do not enable -fcheck-pointer-bounds w/ -fsanitize=bounds
gcc/ChangeLog:
2016-06-09 Martin Liska <mliska@suse.cz>
PR sanitizer/71458
* toplev.c (process_options): Do not enable -fcheck-pointer-bounds
w/ -fsanitize=bounds.
gcc/testsuite/ChangeLog:
2016-06-09 Martin Liska <mliska@suse.cz>
* gcc.target/i386/pr71458.c: New test.
---
gcc/testsuite/gcc.target/i386/pr71458.c | 7 +++++++
gcc/toplev.c | 9 +++++++++
2 files changed, 16 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/i386/pr71458.c
new file mode 100644
@@ -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]); }
@@ -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.8.3