ipa-cp.c (ipa_value_from_jfunc, [...]): Add bounds check.
authorJan Hubicka <hubicka@ucw.cz>
Thu, 5 Feb 2015 18:39:24 +0000 (19:39 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 5 Feb 2015 18:39:24 +0000 (18:39 +0000)
* ipa-cp.c (ipa_value_from_jfunc, ipa_context_from_jfunc): Add bounds
check.

From-SVN: r220458

gcc/ChangeLog
gcc/ipa-cp.c

index f0a330af6165fd7134949ed5010bf6ee141c2fbd..b4c14d1d1b6d26500d2ad707e3472f86f1278724 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-05  Jan Hubicka <hubicka@ucw.cz>
+
+       * ipa-cp.c (ipa_value_from_jfunc, ipa_context_from_jfunc): Add bounds
+       check.
+
 2015-02-05  Joern Rennecke  <joern.rennecke@embecosm.com>
 
        * config/h8300/constraints.md ("U" constraint): Use strict
index 90fd3c29191ef2aa0a147eef04fb17de245e5e53..0c540eb61c71027c331868e888e169f5b4e52f1f 100644 (file)
@@ -942,7 +942,8 @@ ipa_value_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc)
        {
          ipcp_lattice<tree> *lat;
 
-         if (!info->lattices)
+         if (!info->lattices
+             || idx >= ipa_get_param_count (info))
            return NULL_TREE;
          lat = ipa_get_scalar_lat (info, idx);
          if (!lat->is_single_const ())
@@ -1004,7 +1005,8 @@ ipa_context_from_jfunc (ipa_node_params *info, cgraph_edge *cs, int csidx,
        }
       else
        {
-         if (!info->lattices)
+         if (!info->lattices
+             || srcidx >= ipa_get_param_count (info))
            return ctx;
          ipcp_lattice<ipa_polymorphic_call_context> *lat;
          lat = ipa_get_poly_ctx_lat (info, srcidx);