Hello. In order to prevent the ICE, CHKP should not isntrument variables of void type.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin gcc/ChangeLog: 2017-08-09 Martin Liska <mli...@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 <mli...@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)