Hi,
Currently bndret is generated each time we need to get bounds for returned pointer. It causes bndret generated for not instrumented calls incuding builtin function calls. Troubles appear when such builtin call is optimized out - bndret needs to be handled appropriately. Since we don't want not instrumented builtin calls optimizers to be affected by instrumentation, we better avoid bndret for not instrumented calls. This patch uses zero bounds when we don't expect call to return bounds.
Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk?
Thanks,
Ilya
--
gcc/
2014-12-02 Ilya Enkovich <ilya.enkovich@intel.com>
* tree-chkp.c (chkp_call_returns_bounds_p): New.
(chkp_build_returned_bound): Use zero bounds as
returned by calls not returning bounds.
gcc/testsuite/
2014-12-02 Ilya Enkovich <ilya.enkovich@intel.com>
* gcc.target/i386/chkp-bndret.c: New.
* gcc.target/i386/chkp-strchr.c: New.