From 956d3e61a029d40846994b99b7b2b12986ccb047 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 21 Feb 2017 18:46:42 +0100 Subject: [PATCH] re PR target/79633 (ICE in gimple_call_arg, at gimple.h:3163) 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 | 5 +++++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/i386/mpx/pr79633.c | 11 +++++++++++ gcc/tree-chkp-opt.c | 9 +++------ 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pr79633.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a58a516b774..e265311109d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2017-02-21 Jakub Jelinek + 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. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f6f2e373347..02e4dec4cec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2017-02-21 Jakub Jelinek + 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 index 00000000000..2a60ee82971 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr79633.c @@ -0,0 +1,11 @@ +/* PR target/79633 */ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -w -O2" } */ + +extern void *memcpy (); + +void +foo () +{ + memcpy (); +} diff --git a/gcc/tree-chkp-opt.c b/gcc/tree-chkp-opt.c index 6c84caee8ce..ebe05459773 100644 --- a/gcc/tree-chkp-opt.c +++ b/gcc/tree-chkp-opt.c @@ -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 -- 2.30.2