aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2013-06-11 14:50:13 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2013-06-11 14:50:13 +0200
commit97756c0ec5ec388e447b60b45d194a95744cdf68 (patch)
treeaad10bc95ebcb3eb5f7f5cf86de1579552485496 /gcc
parent2c7b8bf6d3e875772946d9c4dd10ecb6a8a8b883 (diff)
downloadgcc-97756c0ec5ec388e447b60b45d194a95744cdf68.zip
gcc-97756c0ec5ec388e447b60b45d194a95744cdf68.tar.gz
gcc-97756c0ec5ec388e447b60b45d194a95744cdf68.tar.bz2
ipa-cp.c (ipa_get_indirect_edge_target_1): Check that param_index is within bounds at the beginning of the function.
2013-06-11 Martin Jambor <mjambor@suse.cz> * ipa-cp.c (ipa_get_indirect_edge_target_1): Check that param_index is within bounds at the beginning of the function. From-SVN: r199953
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/ipa-cp.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f346780..f02e6b2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-11 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-cp.c (ipa_get_indirect_edge_target_1): Check that param_index is
+ within bounds at the beginning of the function.
+
2013-06-11 Alan Modra <amodra@gmail.com>
* varasm.c (get_section): Don't die on !DECL_P decl. Tidy error
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index af4e948..9c29d1d 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -1481,7 +1481,8 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
tree otr_type;
tree t;
- if (param_index == -1)
+ if (param_index == -1
+ || known_vals.length () <= (unsigned int) param_index)
return NULL_TREE;
if (!ie->indirect_info->polymorphic)
@@ -1516,8 +1517,7 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
t = NULL;
}
else
- t = (known_vals.length () > (unsigned int) param_index
- ? known_vals[param_index] : NULL);
+ t = known_vals[param_index];
if (t &&
TREE_CODE (t) == ADDR_EXPR