Message ID | 7102c1d7-6d08-79fa-292c-b33e3f790bce@suse.cz |
---|---|
State | New |
Headers | show |
On Fri, Mar 10, 2017 at 02:09:20PM +0100, Martin Liška wrote: > Hello. > > This is follow-up patch which I agreed on with Jakub. > It enables CHKP with LSAN and majority of UBSAN options. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? > Martin > >From a410d5e4e028d34dc00b4aa637cdcd3986b971d8 Mon Sep 17 00:00:00 2001 > From: marxin <mliska@suse.cz> > Date: Fri, 10 Mar 2017 11:05:27 +0100 > Subject: [PATCH] MPX: Fix option handling. > > gcc/ChangeLog: > > 2017-03-10 Martin Liska <mliska@suse.cz> > > PR target/65705 > PR target/69804 > * toplev.c (process_options): Enable MPX with LSAN and UBSAN > (except -fsanitize=bounds and -fsanitize=bounds-strict). Please avoid the ()s, that is confusing with ()s used to surround function etc. names. Just use UBSAN, except ... strict. > * tree-chkp.c (chkp_walk_pointer_assignments): Verify that > FIELD != NULL. > + error_at (UNKNOWN_LOCATION, > + "-fcheck-pointer-bounds is not supported with " > + "-fsanitize=bounds-strict"); > + flag_check_pointer_bounds = 0; Given the recent i18n discussions, perhaps this ought to be %<-fcheck-pointer-bounds%> and %<-fsanitize=bounds-strict%> and similarly elsewhere (of course not for Address/Thread Sanitizer words). Ok for trunk either way. Jakub
Jakub Jelinek <jakub@redhat.com> writes: > On Fri, Mar 10, 2017 at 02:09:20PM +0100, Martin Liška wrote: >> Hello. >> >> This is follow-up patch which I agreed on with Jakub. >> It enables CHKP with LSAN and majority of UBSAN options. >> >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >> >> Ready to be installed? >> Martin > >> >From a410d5e4e028d34dc00b4aa637cdcd3986b971d8 Mon Sep 17 00:00:00 2001 >> From: marxin <mliska@suse.cz> >> Date: Fri, 10 Mar 2017 11:05:27 +0100 >> Subject: [PATCH] MPX: Fix option handling. >> >> gcc/ChangeLog: >> >> 2017-03-10 Martin Liska <mliska@suse.cz> >> >> PR target/65705 >> PR target/69804 >> * toplev.c (process_options): Enable MPX with LSAN and UBSAN >> (except -fsanitize=bounds and -fsanitize=bounds-strict). > > Please avoid the ()s, that is confusing with ()s used to surround > function etc. names. Just use UBSAN, > except ... strict. > >> * tree-chkp.c (chkp_walk_pointer_assignments): Verify that >> FIELD != NULL. > >> + error_at (UNKNOWN_LOCATION, >> + "-fcheck-pointer-bounds is not supported with " >> + "-fsanitize=bounds-strict"); >> + flag_check_pointer_bounds = 0; > > Given the recent i18n discussions, perhaps this ought to be > %<-fcheck-pointer-bounds%> and %<-fsanitize=bounds-strict%> and similarly > elsewhere (of course not for Address/Thread Sanitizer words). > > Ok for trunk either way. Unfortunately, that last change broke gcc.target/i386/pr65044.c: FAIL: gcc.target/i386/pr65044.c (test for errors, line ) FAIL: gcc.target/i386/pr65044.c (test for excess errors) seen e.g. on Linux/x86_64 and Solaris/x86. We have Excess errors: cc1: error: '-fcheck-pointer-bounds' is not supported with Address Sanitizer while the test expects /* { dg-error "-fcheck-pointer-bounds is not supported with Address Sanitizer" "" { target *-*-* } 0 } */ I guess that, given gcc-dg.exp hardcodes LANG=C, changing the dg-error to just include the single quotes should be enough. Rainer
From a410d5e4e028d34dc00b4aa637cdcd3986b971d8 Mon Sep 17 00:00:00 2001 From: marxin <mliska@suse.cz> Date: Fri, 10 Mar 2017 11:05:27 +0100 Subject: [PATCH] MPX: Fix option handling. gcc/ChangeLog: 2017-03-10 Martin Liska <mliska@suse.cz> PR target/65705 PR target/69804 * toplev.c (process_options): Enable MPX with LSAN and UBSAN (except -fsanitize=bounds and -fsanitize=bounds-strict). * tree-chkp.c (chkp_walk_pointer_assignments): Verify that FIELD != NULL. --- gcc/testsuite/gcc.target/i386/pr71458.c | 2 +- gcc/toplev.c | 47 +++++++++++++++++++-------------- gcc/tree-chkp.c | 2 +- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/gcc/testsuite/gcc.target/i386/pr71458.c b/gcc/testsuite/gcc.target/i386/pr71458.c index 2faf6bb9391..27e7764b5a0 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..38bc33e007e 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1274,27 +1274,34 @@ process_options (void) 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 c057b977342..fdb95ee5cc6 100644 --- a/gcc/tree-chkp.c +++ b/gcc/tree-chkp.c @@ -3804,7 +3804,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); -- 2.11.1