summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-10 13:24:45 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-10 13:24:45 +0000
commit26bc3355ed997fb32339434c036d5da9c47d4e0f (patch)
treeae3fd8506b2f139ad2ff8a99c72c1db504ee9132
parent41c5ff99d7e3db9a7d10fd180075ff173084e66c (diff)
downloadgcc-26bc3355ed997fb32339434c036d5da9c47d4e0f.tar.gz
MPX: Fix option handling.
2017-03-10 Martin Liska <mliska@suse.cz> PR target/65705 PR target/69804 * toplev.c (process_options): Enable MPX with LSAN and UBSAN. * tree-chkp.c (chkp_walk_pointer_assignments): Verify that FIELD != NULL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246027 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr71458.c2
-rw-r--r--gcc/toplev.c50
-rw-r--r--gcc/tree-chkp.c2
4 files changed, 39 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5050ca8d822..306b5f140b6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2017-03-10 Martin Liska <mliska@suse.cz>
+
+ PR target/65705
+ PR target/69804
+ * toplev.c (process_options): Enable MPX with LSAN and UBSAN.
+ * tree-chkp.c (chkp_walk_pointer_assignments): Verify that
+ FIELD != NULL.
+
2017-03-10 Olivier Hainque <hainque@adacore.com>
* tree-switch-conversion (array_value_type): Start by resetting
diff --git a/gcc/testsuite/gcc.target/i386/pr71458.c b/gcc/testsuite/gcc.target/i386/pr71458.c
index 2faf6bb9391..d36b61cbe02 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 Undefined Behavior Sanitizer" "" { target *-*-* } 0 } */
+/* { dg-error "'-fcheck-pointer-bounds' is not supported with '-fsanitize=bounds'" "" { target *-*-* } 0 } */
enum {} a[0];
void fn1(int);
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 6a7e4fbdffb..54a4f05c9a1 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1270,31 +1270,39 @@ process_options (void)
if (targetm.chkp_bound_mode () == VOIDmode)
{
error_at (UNKNOWN_LOCATION,
- "-fcheck-pointer-bounds is not supported for this target");
+ "%<-fcheck-pointer-bounds%> is not supported for this "
+ "target");
flag_check_pointer_bounds = 0;
}
- if (flag_sanitize)
+ if (flag_sanitize & SANITIZE_BOUNDS_STRICT)
{
- 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");
+ error_at (UNKNOWN_LOCATION,
+ "%<-fcheck-pointer-bounds%> is not supported with "
+ "%<-fsanitize=bounds-strict%>");
+ flag_check_pointer_bounds = 0;
+ }
+ else if (flag_sanitize & SANITIZE_BOUNDS)
+ {
+ error_at (UNKNOWN_LOCATION,
+ "%<-fcheck-pointer-bounds%> is not supported with "
+ "%<-fsanitize=bounds%>");
+ flag_check_pointer_bounds = 0;
+ }
+
+ if (flag_sanitize & SANITIZE_ADDRESS)
+ {
+ error_at (UNKNOWN_LOCATION,
+ "%<-fcheck-pointer-bounds%> is not supported with "
+ "Address Sanitizer");
+ flag_check_pointer_bounds = 0;
+ }
+
+ if (flag_sanitize & SANITIZE_THREAD)
+ {
+ error_at (UNKNOWN_LOCATION,
+ "%<-fcheck-pointer-bounds%> is not supported with "
+ "Thread Sanitizer");
flag_check_pointer_bounds = 0;
}
diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
index acd57eac5ef..75caf83a982 100644
--- a/gcc/tree-chkp.c
+++ b/gcc/tree-chkp.c
@@ -3803,7 +3803,7 @@ chkp_walk_pointer_assignments (tree lhs, tree rhs, void *arg,
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (rhs), cnt, field, val)
{
- if (chkp_type_has_pointer (TREE_TYPE (field)))
+ if (field && chkp_type_has_pointer (TREE_TYPE (field)))
{
tree lhs_field = chkp_build_component_ref (lhs, field);
chkp_walk_pointer_assignments (lhs_field, val, arg, handler);