diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-06-04 18:00:47 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-06-04 18:00:47 +0000 |
commit | 92ceb887290032fe8c0a44bd9054ee61ee8e5f70 (patch) | |
tree | 476529c301eab3847fc3d9016c03f7c11a2de064 /gcc/ipa-inline-analysis.c | |
parent | 0fddc25daead4091d08b4615161aa84468aa9405 (diff) | |
download | gcc-92ceb887290032fe8c0a44bd9054ee61ee8e5f70.tar.gz |
PR tree-optimization/48893
PR tree-optimization/49091
PR tree-optimization/49179
* ipa-inline-analysis.c (evaluate_conditions_for_known_args):
Bounds check.
* gfortran.dg/pr49179.f90: New testcase
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174648 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-inline-analysis.c')
-rw-r--r-- | gcc/ipa-inline-analysis.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 45bfeb6f471..ccda67de462 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -555,9 +555,17 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, for (i = 0; VEC_iterate (condition, info->conds, i, c); i++) { - tree val = VEC_index (tree, known_vals, c->operand_num); + tree val; tree res; + /* We allow call stmt to have fewer arguments than the callee + function (especially for K&R style programs). So bound + check here. */ + if (c->operand_num < (int)VEC_length (tree, known_vals)) + val = VEC_index (tree, known_vals, c->operand_num); + else + val = NULL; + if (!val) { clause |= 1 << (i + predicate_first_dynamic_condition); |