Hi,

we generally do not have ther ability to propagate constants to and
clone CHKP instrumented functions.  Therefore we do not propagate
stuff into their lattices but since Honza changed cloning for all
contexts heuristics a few weeks ago, we might attempt to clone them
for unused parameter removal, which then leads to an ICE (and all
sorts of issues).

The heuristics however should not attempt to do that because the
function cgraph_node has can_change_signature flag cleared.  So this
patch changes it accordingly.  Bootstrapped and tested on
x86_64-linux, OK for trunk?

Thanks,

Martin


2016-01-08  Martin Jambor  <mjam...@suse.cz>

        PR ipa/69044
        * ipa-cp.c (estimate_local_effects): Do not clone for removal of
        useless parameters if we cannot change function signature.

testsuite/
        * gcc.target/i386/chkp-pr69044.c: New test.

diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 782df71..d99e69c 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -2518,7 +2518,8 @@ estimate_local_effects (struct cgraph_node *node)
   known_aggs_ptrs = agg_jmp_p_vec_for_t_vec (known_aggs);
   int devirt_bonus = devirtualization_time_bonus (node, known_csts,
                                           known_contexts, known_aggs_ptrs);
-  if (always_const || devirt_bonus || removable_params_cost)
+  if (always_const || devirt_bonus
+      || (removable_params_cost && node->local.can_change_signature))
     {
       struct caller_statistics stats;
       inline_hints hints;
diff --git a/gcc/testsuite/gcc.target/i386/chkp-pr69044.c 
b/gcc/testsuite/gcc.target/i386/chkp-pr69044.c
new file mode 100644
index 0000000..933e88a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/chkp-pr69044.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target mpx } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */
+
+int i;
+int strncasecmp (char *p1, char *p2, long p3) { return 0; }
+int special_command ()
+{
+  if (strncasecmp (0, 0, 0))
+    i++;
+}

Reply via email to