aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/symbol.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2014-06-12 20:35:00 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2014-06-12 20:35:00 +0200
commit8fdcb6a997e7125d155b79947a1793f01611527b (patch)
tree031a2f7aac4534d08879ee1f3ad488ddc5eec811 /gcc/fortran/symbol.c
parent551a6341d5d0fed634c71f710bdae6d7b6b1491e (diff)
downloadgcc-8fdcb6a997e7125d155b79947a1793f01611527b.zip
gcc-8fdcb6a997e7125d155b79947a1793f01611527b.tar.gz
gcc-8fdcb6a997e7125d155b79947a1793f01611527b.tar.bz2
gfortran.h (gfc_copy_formal_args_intr): Update prototype.
2014-06-12 Tobias Burnus <burnus@net-b.de> * gfortran.h (gfc_copy_formal_args_intr): Update prototype. * symbol.c (gfc_copy_formal_args_intr): Handle the case that absent optional arguments should be ignored. * trans-intrinsic.c (gfc_get_symbol_for_expr): Ditto. (gfc_conv_intrinsic_funcall, conv_generic_with_optional_char_arg): Update call. * resolve.c (gfc_resolve_intrinsic): Ditto. From-SVN: r211587
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r--gcc/fortran/symbol.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index a0995b5..922b421 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -4042,16 +4042,21 @@ add_proc_interface (gfc_symbol *sym, ifsrc source, gfc_formal_arglist *formal)
each arg is set according to the existing ones. This function is
used when creating procedure declaration variables from a procedure
declaration statement (see match_proc_decl()) to create the formal
- args based on the args of a given named interface. */
+ args based on the args of a given named interface.
+
+ When an actual argument list is provided, skip the absent arguments.
+ To be used together with gfc_se->ignore_optional. */
void
-gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src)
+gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src,
+ gfc_actual_arglist *actual)
{
gfc_formal_arglist *head = NULL;
gfc_formal_arglist *tail = NULL;
gfc_formal_arglist *formal_arg = NULL;
gfc_intrinsic_arg *curr_arg = NULL;
gfc_formal_arglist *formal_prev = NULL;
+ gfc_actual_arglist *act_arg = actual;
/* Save current namespace so we can change it for formal args. */
gfc_namespace *parent_ns = gfc_current_ns;
@@ -4062,6 +4067,17 @@ gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src)
for (curr_arg = src->formal; curr_arg; curr_arg = curr_arg->next)
{
+ /* Skip absent arguments. */
+ if (actual)
+ {
+ gcc_assert (act_arg != NULL);
+ if (act_arg->expr == NULL)
+ {
+ act_arg = act_arg->next;
+ continue;
+ }
+ act_arg = act_arg->next;
+ }
formal_arg = gfc_get_formal_arglist ();
gfc_get_symbol (curr_arg->name, gfc_current_ns, &(formal_arg->sym));