Message ID | 45d4e8de-eea8-7c8c-5fec-0eca629c7738@suse.cz |
---|---|
State | New |
Headers | show |
2017-08-10 10:40 GMT+03:00 Martin Liška <mliska@suse.cz>: > Hello. > > In order to prevent the ICE, CHKP should not isntrument variables of void type. Hi, There was another thread for this PR where I proposed a way to handle such vars via size relocations. But there was no feedback in that thread for two months and skipping void var is better than ICE. The patch is OK then. Thanks, Ilya > > Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. > > Ready to be installed? > Martin > > gcc/ChangeLog: > > 2017-08-09 Martin Liska <mliska@suse.cz> > > PR tree-opt/79987 > * tree-chkp.c (chkp_get_bounds_for_decl_addr): Do not instrument > variables of void type. > > gcc/testsuite/ChangeLog: > > 2017-08-09 Martin Liska <mliska@suse.cz> > > PR tree-opt/79987 > * gcc.target/i386/mpx/pr79987.c: New test. > --- > gcc/testsuite/gcc.target/i386/mpx/pr79987.c | 5 +++++ > gcc/tree-chkp.c | 3 +++ > 2 files changed, 8 insertions(+) > create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pr79987.c > >
On 08/11/2017 01:51 AM, Ilya Enkovich wrote: > 2017-08-10 10:40 GMT+03:00 Martin Liška <mliska@suse.cz>: >> Hello. >> >> In order to prevent the ICE, CHKP should not isntrument variables of void type. > > Hi, > > There was another thread for this PR where I proposed a way to handle such vars > via size relocations. But there was no feedback in that thread for two > months and > skipping void var is better than ICE. The patch is OK then. Yep, probably does not worth doing that with relocations. Thanks for review. Martin > > Thanks, > Ilya > >> >> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. >> >> Ready to be installed? >> Martin >> >> gcc/ChangeLog: >> >> 2017-08-09 Martin Liska <mliska@suse.cz> >> >> PR tree-opt/79987 >> * tree-chkp.c (chkp_get_bounds_for_decl_addr): Do not instrument >> variables of void type. >> >> gcc/testsuite/ChangeLog: >> >> 2017-08-09 Martin Liska <mliska@suse.cz> >> >> PR tree-opt/79987 >> * gcc.target/i386/mpx/pr79987.c: New test. >> --- >> gcc/testsuite/gcc.target/i386/mpx/pr79987.c | 5 +++++ >> gcc/tree-chkp.c | 3 +++ >> 2 files changed, 8 insertions(+) >> create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pr79987.c >> >>
diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr79987.c b/gcc/testsuite/gcc.target/i386/mpx/pr79987.c new file mode 100644 index 00000000000..b3ebda95694 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr79987.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +extern void foo; +void *bar = &foo; /* { dg-warning "taking address of expression of type .void." } */ diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c index 12af458fb90..951aec10b3a 100644 --- a/gcc/tree-chkp.c +++ b/gcc/tree-chkp.c @@ -3197,6 +3197,9 @@ chkp_get_bounds_for_decl_addr (tree decl) && !flag_chkp_incomplete_type) return chkp_get_zero_bounds (); + if (VOID_TYPE_P (TREE_TYPE (decl))) + return chkp_get_zero_bounds (); + if (flag_chkp_use_static_bounds && VAR_P (decl) && (TREE_STATIC (decl)