Commit 8823ce3f by Martin Liska Committed by Martin Liska

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.

From-SVN: r246027
parent 74106ead
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> 2017-03-10 Olivier Hainque <hainque@adacore.com>
* tree-switch-conversion (array_value_type): Start by resetting * tree-switch-conversion (array_value_type): Start by resetting
......
/* { dg-do compile { target { ! x32 } } } */ /* { dg-do compile { target { ! x32 } } } */
/* { dg-options "-fcheck-pointer-bounds -mmpx -fsanitize=bounds" } */ /* { 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]; enum {} a[0];
void fn1(int); void fn1(int);
......
...@@ -1270,31 +1270,39 @@ process_options (void) ...@@ -1270,31 +1270,39 @@ process_options (void)
if (targetm.chkp_bound_mode () == VOIDmode) if (targetm.chkp_bound_mode () == VOIDmode)
{ {
error_at (UNKNOWN_LOCATION, 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; flag_check_pointer_bounds = 0;
} }
if (flag_sanitize) if (flag_sanitize & SANITIZE_BOUNDS_STRICT)
{ {
if (flag_sanitize & SANITIZE_ADDRESS) error_at (UNKNOWN_LOCATION,
error_at (UNKNOWN_LOCATION, "%<-fcheck-pointer-bounds%> is not supported with "
"-fcheck-pointer-bounds is not supported with " "%<-fsanitize=bounds-strict%>");
"Address Sanitizer"); flag_check_pointer_bounds = 0;
}
if (flag_sanitize & (SANITIZE_UNDEFINED | SANITIZE_NONDEFAULT)) else if (flag_sanitize & SANITIZE_BOUNDS)
error_at (UNKNOWN_LOCATION, {
"-fcheck-pointer-bounds is not supported with " error_at (UNKNOWN_LOCATION,
"Undefined Behavior Sanitizer"); "%<-fcheck-pointer-bounds%> is not supported with "
"%<-fsanitize=bounds%>");
if (flag_sanitize & SANITIZE_LEAK) flag_check_pointer_bounds = 0;
error_at (UNKNOWN_LOCATION, }
"-fcheck-pointer-bounds is not supported with "
"Leak Sanitizer"); if (flag_sanitize & SANITIZE_ADDRESS)
{
if (flag_sanitize & SANITIZE_THREAD) error_at (UNKNOWN_LOCATION,
error_at (UNKNOWN_LOCATION, "%<-fcheck-pointer-bounds%> is not supported with "
"-fcheck-pointer-bounds is not supported with " "Address Sanitizer");
"Thread 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; flag_check_pointer_bounds = 0;
} }
......
...@@ -3803,7 +3803,7 @@ chkp_walk_pointer_assignments (tree lhs, tree rhs, void *arg, ...@@ -3803,7 +3803,7 @@ chkp_walk_pointer_assignments (tree lhs, tree rhs, void *arg,
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (rhs), cnt, field, val) 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); tree lhs_field = chkp_build_component_ref (lhs, field);
chkp_walk_pointer_assignments (lhs_field, val, arg, handler); chkp_walk_pointer_assignments (lhs_field, val, arg, handler);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment