diff options
author | Jan Hubicka <jh@suse.cz> | 2011-06-04 20:00:47 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2011-06-04 18:00:47 +0000 |
commit | a45c05572191ff9fe6b0f260008a4408453d6a7f (patch) | |
tree | 476529c301eab3847fc3d9016c03f7c11a2de064 /gcc | |
parent | 6c6424b3d7fc813396ee33d3d1ebb65d210aecc5 (diff) | |
download | gcc-a45c05572191ff9fe6b0f260008a4408453d6a7f.zip gcc-a45c05572191ff9fe6b0f260008a4408453d6a7f.tar.gz gcc-a45c05572191ff9fe6b0f260008a4408453d6a7f.tar.bz2 |
re PR middle-end/48893 (ICE in evaulate_conditions_for_edge at ipa-inline-analysis.c:477)
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
From-SVN: r174648
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ipa-inline-analysis.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr49179.f90 | 11 |
4 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5fdd07c..3082d71 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2011-06-04 Jan Hubicka <jh@suse.cz> + PR tree-optimization/48893 + PR tree-optimization/49091 + PR tree-optimization/49179 + * ipa-inline-analysis.c (evaluate_conditions_for_known_args): + Bounds check. + +2011-06-04 Jan Hubicka <jh@suse.cz> + PR lto/48954 * lto-cgraph.c (output_node_opt_summary): Handle NULL skip args bitmaps. diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 45bfeb6..ccda67d 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b88637c..c4080ff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,12 @@ 2011-06-04 Jan Hubicka <jh@suse.cz> + PR tree-optimization/48893 + PR tree-optimization/49091 + PR tree-optimization/49179 + * gfortran.dg/pr49179.f90: New testcase + +2011-06-04 Jan Hubicka <jh@suse.cz> + PR lto/48954 * g++.dg/torture/pr48954.C: New testcase. diff --git a/gcc/testsuite/gfortran.dg/pr49179.f90 b/gcc/testsuite/gfortran.dg/pr49179.f90 new file mode 100644 index 0000000..0a86e9e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr49179.f90 @@ -0,0 +1,11 @@ +! { dg-options " -O -findirect-inlining" } +function more_OK (fcn) + character(*) more_OK + character (*), external :: fcn + more_OK = fcn () +end function more_OK + character(4) :: answer + character(4), external :: is_OK, more_OK + answer = more_OK (is_OK) +contains +END |