===================================================================
@@ -555,9 +555,17 @@ evaluate_conditions_for_known_args (stru
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);
===================================================================
@@ -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