Hi, This patch fixes PR target/65508 by proper copy of static chain for instrumented calls. Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk or wait for stage 1?
Thanks, Ilya -- gcc/ 2015-03-25 Ilya Enkovich <ilya.enkov...@intel.com> PR target/65508 * tree-chkp.c (chkp_add_bounds_to_call_stmt): Set static chain for generated call. gcc/testsuite/ 2015-03-25 Ilya Enkovich <ilya.enkov...@intel.com> PR target/65508 * gcc.target/i386/mpx/pr65508.c: New. diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr65508.c b/gcc/testsuite/gcc.target/i386/mpx/pr65508.c new file mode 100644 index 0000000..9060287 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr65508.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx" } */ + +void +bar (int N) +{ + int a[N]; + void foo (int a[N]) + { + } + foo (a); +} diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c index d2df4ba..de127ae 100644 --- a/gcc/tree-chkp.c +++ b/gcc/tree-chkp.c @@ -1838,6 +1838,7 @@ chkp_add_bounds_to_call_stmt (gimple_stmt_iterator *gsi) new_call = gimple_build_call_vec (gimple_op (call, 1), new_args); gimple_call_set_lhs (new_call, gimple_call_lhs (call)); gimple_call_copy_flags (new_call, call); + gimple_call_set_chain (new_call, gimple_call_chain (call)); } new_args.release ();