aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
authorTobias Schlüter <tobi@gcc.gnu.org>2004-06-04 00:35:41 +0200
committerTobias Schlüter <tobi@gcc.gnu.org>2004-06-04 00:35:41 +0200
commit1600fe22b9c077d311efd4c677b80d2fa0efb17e (patch)
tree1c845ff438eb6e41b7432a288e671baf85346e7a /gcc/fortran/interface.c
parented5947c9bcae4c500c8e96f2809b4df527234804 (diff)
downloadgcc-1600fe22b9c077d311efd4c677b80d2fa0efb17e.zip
gcc-1600fe22b9c077d311efd4c677b80d2fa0efb17e.tar.gz
gcc-1600fe22b9c077d311efd4c677b80d2fa0efb17e.tar.bz2
gfortran.h (gfc_actual_arglist): New field missing_arg_type.
fortran/ * gfortran.h (gfc_actual_arglist): New field missing_arg_type. * interface.c (compare_actual_formal): Keep type of omitted optional arguments. * trans-expr.c (gfc_conv_function_call): Add string length argument for omitted string argument. testsuite/ * gfortran.fortran-torture/execute/optstring_1.f90: New testcase. From-SVN: r82608
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r--gcc/fortran/interface.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index a3c3acc..30706d4 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1096,7 +1096,8 @@ compare_parameter (gfc_symbol * formal, gfc_expr * actual,
return compare_interfaces (formal, actual->symtree->n.sym, 0);
}
- if (!gfc_compare_types (&formal->ts, &actual->ts))
+ if (actual->expr_type != EXPR_NULL
+ && !gfc_compare_types (&formal->ts, &actual->ts))
return 0;
if (symbol_rank (formal) == actual->rank)
@@ -1235,7 +1236,8 @@ compare_actual_formal (gfc_actual_arglist ** ap,
return 0;
}
- if (compare_pointer (f->sym, a->expr) == 0)
+ if (a->expr->expr_type != EXPR_NULL
+ && compare_pointer (f->sym, a->expr) == 0)
{
if (where)
gfc_error ("Actual argument for '%s' must be a pointer at %L",
@@ -1291,6 +1293,11 @@ compare_actual_formal (gfc_actual_arglist ** ap,
if (*ap == NULL && n > 0)
*ap = new[0];
+ /* Note the types of omitted optional arguments. */
+ for (a = actual, f = formal; a; a = a->next, f = f->next)
+ if (a->expr == NULL && a->label == NULL)
+ a->missing_arg_type = f->sym->ts.type;
+
return 1;
}