re PR target/79633 (ICE in gimple_call_arg, at gimple.h:3163)
authorJakub Jelinek <jakub@redhat.com>
Tue, 21 Feb 2017 17:46:42 +0000 (18:46 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 21 Feb 2017 17:46:42 +0000 (18:46 +0100)
PR target/79633
* tree-chkp-opt.c (chkp_optimize_string_function_calls): Use
is_gimple_call instead of comparing gimple_code with GIMPLE_CALL.
Use gimple_call_builtin_p.

* gcc.target/i386/mpx/pr79633.c: New test.

From-SVN: r245634

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

index a58a516b7747fc9d7525097c31dae28a2dda92ed..e265311109d2a66894b885c3f30282f723e5d85c 100644 (file)
@@ -1,5 +1,10 @@
 2017-02-21  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/79633
+       * tree-chkp-opt.c (chkp_optimize_string_function_calls): Use
+       is_gimple_call instead of comparing gimple_code with GIMPLE_CALL.
+       Use gimple_call_builtin_p.
+
        PR target/79570
        * sel-sched.c (moveup_expr_cached): Don't call sel_bb_head
        on temporarily removed DEBUG_INSNs.
index f6f2e373347b8dc50486b9a63de933eb547ec756..02e4dec4ceca32c49c109148b8e1075eeedaebf1 100644 (file)
@@ -1,5 +1,8 @@
 2017-02-21  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/79633
+       * gcc.target/i386/mpx/pr79633.c: New test.
+
        PR target/79570
        * gcc.dg/pr79570.c: New test.
 
diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr79633.c b/gcc/testsuite/gcc.target/i386/mpx/pr79633.c
new file mode 100644 (file)
index 0000000..2a60ee8
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR target/79633 */
+/* { dg-do compile } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -w -O2" } */
+
+extern void *memcpy ();
+
+void
+foo ()
+{
+  memcpy ();
+}
index 6c84caee8ce7d3de35c3758969f983155bb7b9b1..ebe0545977313f04f5ff85d3f775862cf646a01e 100644 (file)
@@ -964,15 +964,12 @@ chkp_optimize_string_function_calls (void)
          gimple *stmt = gsi_stmt (i);
          tree fndecl;
 
-         if (gimple_code (stmt) != GIMPLE_CALL
-             || !gimple_call_with_bounds_p (stmt))
+         if (!is_gimple_call (stmt)
+             || !gimple_call_with_bounds_p (stmt)
+             || !gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
            continue;
 
          fndecl = gimple_call_fndecl (stmt);
-
-         if (!fndecl || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL)
-           continue;
-
          if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMCPY_CHKP
              || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMPCPY_CHKP
              || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMMOVE_CHKP