From 370a7814fcfa84017eb844b99607517855a9d280 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 5 Feb 2015 19:39:24 +0100 Subject: [PATCH] ipa-cp.c (ipa_value_from_jfunc, [...]): Add bounds check. * ipa-cp.c (ipa_value_from_jfunc, ipa_context_from_jfunc): Add bounds check. From-SVN: r220458 --- gcc/ChangeLog | 5 +++++ gcc/ipa-cp.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f0a330af616..b4c14d1d1b6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-02-05 Jan Hubicka + + * ipa-cp.c (ipa_value_from_jfunc, ipa_context_from_jfunc): Add bounds + check. + 2015-02-05 Joern Rennecke * config/h8300/constraints.md ("U" constraint): Use strict diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 90fd3c29191..0c540eb61c7 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -942,7 +942,8 @@ ipa_value_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc) { ipcp_lattice *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 *lat; lat = ipa_get_poly_ctx_lat (info, srcidx); -- 2.30.2