diff options
author | Jan Hubicka <jh@suse.cz> | 2012-01-08 16:32:49 +0000 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2012-01-08 16:32:49 +0000 |
commit | 560634100734a04e49a475a5a96b38bc8ac00490 (patch) | |
tree | a713926c58706e6da15d85a29a262e6f8cb3072d /gcc/ipa-cp.c | |
parent | fe624478d5a19b1f68e58ccaa745db51fbb6a3a4 (diff) |
PR tree-optimize/51694
* ipa-cp.c (ipa_get_indirect_edge_target): Add bounds checks.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@182993 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r-- | gcc/ipa-cp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 2a82df1032f..ae38366c2ca 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1112,7 +1112,8 @@ ipa_get_indirect_edge_target (struct cgraph_edge *ie, if (!ie->indirect_info->polymorphic) { - tree t = VEC_index (tree, known_vals, param_index); + tree t = (VEC_length (tree, known_vals) > param_index + ? VEC_index (tree, known_vals, param_index) : NULL); if (t && TREE_CODE (t) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (t, 0)) == FUNCTION_DECL) @@ -1126,7 +1127,7 @@ ipa_get_indirect_edge_target (struct cgraph_edge *ie, otr_type = ie->indirect_info->otr_type; t = VEC_index (tree, known_vals, param_index); - if (!t && known_binfos) + if (!t && known_binfos && VEC_length (tree, known_binfos) > param_index) t = VEC_index (tree, known_binfos, param_index); if (!t) return NULL_TREE; |