Fix ICE in tree-chkp-opt.c (PR tree-optimization/79631).
authorMartin Liska <mliska@suse.cz>
Thu, 9 Mar 2017 10:10:02 +0000 (11:10 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 9 Mar 2017 10:10:02 +0000 (10:10 +0000)
2017-03-09  Martin Liska  <mliska@suse.cz>

PR tree-optimization/79631
* tree-chkp-opt.c (chkp_is_constant_addr): Call
tree_int_cst_sign_bit just for INTEGER constants.
2017-03-09  Martin Liska  <mliska@suse.cz>

PR tree-optimization/79631
* gcc.target/i386/mpx/pr79631.c: New test.

From-SVN: r245998

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/mpx/pr79631.c [new file with mode: 0644]
gcc/tree-chkp-opt.c

index 33670ab..c3718e3 100644 (file)
@@ -1,5 +1,11 @@
 2017-03-09  Martin Liska  <mliska@suse.cz>
 
+       PR tree-optimization/79631
+       * tree-chkp-opt.c (chkp_is_constant_addr): Call
+       tree_int_cst_sign_bit just for INTEGER constants.
+
+2017-03-09  Martin Liska  <mliska@suse.cz>
+
        PR target/65705
        PR target/69804
        * toplev.c (process_options): Disable -fcheck-pointer-bounds with
index e31735b..f576273 100644 (file)
@@ -1,5 +1,10 @@
 2017-03-09  Martin Liska  <mliska@suse.cz>
 
+       PR tree-optimization/79631
+       * gcc.target/i386/mpx/pr79631.c: New test.
+
+2017-03-09  Martin Liska  <mliska@suse.cz>
+
        PR target/65705
        PR target/69804
        * gcc.target/i386/pr71458.c: Update scanned pattern.
diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr79631.c b/gcc/testsuite/gcc.target/i386/mpx/pr79631.c
new file mode 100644 (file)
index 0000000..075d46b
--- /dev/null
@@ -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++;
+  }
+}
index ebe0545..ab98edb 100644 (file)
@@ -239,9 +239,11 @@ chkp_is_constant_addr (const address_t &addr, int *sign)
     return false;
   else if (addr.pol[0].var)
     return false;
+  else if (TREE_CODE (addr.pol[0].cst) != INTEGER_CST)
+    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_int_cst_sign_bit (addr.pol[0].cst))
     *sign = -1;
   else
     *sign = 1;