gcc/ChangeLog: 2017-03-06 Martin Liska <mli...@suse.cz>
PR tree-optimization/79631 * tree-chkp-opt.c (chkp_is_constant_addr): Call tree_int_cst_sign_bit just for INTEGER constants. gcc/testsuite/ChangeLog: 2017-03-06 Martin Liska <mli...@suse.cz> PR tree-optimization/79631 * gcc.target/i386/mpx/pr79631.c: New test. --- gcc/testsuite/gcc.target/i386/mpx/pr79631.c | 15 +++++++++++++++ gcc/tree-chkp-opt.c | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pr79631.c diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr79631.c b/gcc/testsuite/gcc.target/i386/mpx/pr79631.c new file mode 100644 index 00000000000..075d46b835f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr79631.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { ! x32 } } } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */ + +typedef struct { int _mp_size; } mpz_t[1]; +int a, b; +void fn1() +{ + mpz_t c[1][b]; + for (;;) { + int d = 0 >= 0 ? 0 == 0 ? c[0][0]->_mp_size ? -1 : 0 : 0 : 0, + e = 0 >= 0 ? 0 == 0 ? c[1][1]->_mp_size ? -1 : 0 : 0 : 0; + if (d != e) + a++; + } +} diff --git a/gcc/tree-chkp-opt.c b/gcc/tree-chkp-opt.c index ebe05459773..286f7853921 100644 --- a/gcc/tree-chkp-opt.c +++ b/gcc/tree-chkp-opt.c @@ -241,7 +241,8 @@ chkp_is_constant_addr (const address_t &addr, int *sign) return false; else if (integer_zerop (addr.pol[0].cst)) *sign = 0; - else if (tree_int_cst_sign_bit (addr.pol[0].cst)) + else if (TREE_CODE (addr.pol[0].cst) == INTEGER_CST + && tree_int_cst_sign_bit (addr.pol[0].cst)) *sign = -1; else *sign = 1; -- 2.11.1