re PR middle-end/50301 (416.gamess in SPEC CPU 2006 failed to build with LTO)
authorMartin Jambor <mjambor@suse.cz>
Wed, 7 Sep 2011 14:31:40 +0000 (16:31 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Wed, 7 Sep 2011 14:31:40 +0000 (16:31 +0200)
2011-09-07  Martin Jambor  <mjambor@suse.cz>

PR middle-end/50301
* ipa-cp.c (find_more_values_for_callers_subset): Check jump
function index bounds.
(perhaps_add_new_callers): Likewise.

From-SVN: r178640

gcc/ChangeLog
gcc/ipa-cp.c

index 4df7eae2ccb4bfe6168079f87659b706d9da0ffb..d7b8687a94325d4a31f8e38f41cd7714c7ba73f9 100644 (file)
@@ -1,3 +1,10 @@
+2011-09-07  Martin Jambor  <mjambor@suse.cz>
+
+       PR middle-end/50301
+       * ipa-cp.c (find_more_values_for_callers_subset): Check jump
+       function index bounds.
+       (perhaps_add_new_callers): Likewise.
+
 2011-09-07  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/49911
index f6e083e66542c536da2d8e001c65279d82d26c66..f440b1dc74dd5dc6881ab38b963d8495037750f9 100644 (file)
@@ -2052,8 +2052,12 @@ find_more_values_for_callers_subset (struct cgraph_node *node,
          struct ipa_jump_func *jump_func;
          tree t;
 
+          if (i >= ipa_get_cs_argument_count (IPA_EDGE_REF (cs)))
+            {
+              newval = NULL_TREE;
+              break;
+            }
          jump_func = ipa_get_ith_jump_func (IPA_EDGE_REF (cs), i);
-
          t = ipa_value_from_jfunc (IPA_NODE_REF (cs->caller), jump_func);
          if (!t
              || (newval
@@ -2123,6 +2127,11 @@ perhaps_add_new_callers (struct cgraph_node *node, struct ipcp_value *val)
                  if (!val)
                    continue;
 
+                 if (i >= ipa_get_cs_argument_count (args))
+                   {
+                     insufficient = true;
+                     break;
+                   }
                  jump_func = ipa_get_ith_jump_func (args, i);
                  t = ipa_value_from_jfunc (caller_info, jump_func);
                  if (!t || !values_equal_for_ipcp_p (val, t))