diff options
author | janus <janus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-24 10:59:56 +0000 |
---|---|---|
committer | janus <janus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-24 10:59:56 +0000 |
commit | a84cb1a9aa78048db7cea2fe645d52451524f092 (patch) | |
tree | a8542fe2b693d75e3d9116f00704aa7e5a014c21 /gcc/fortran/interface.c | |
parent | 55bf42adac53aa1c9e33b8170c67430c9cdff4e0 (diff) | |
download | gcc-a84cb1a9aa78048db7cea2fe645d52451524f092.tar.gz |
2009-06-24 Janus Weil <janus@gcc.gnu.org>
PR fortran/40427
* gfortran.h (gfc_component): New member 'formal_ns'.
(gfc_copy_formal_args_ppc,void gfc_ppc_use): New.
* interface.c (gfc_ppc_use): New function, analogous to
gfc_procedure_use, but for procedure pointer components.
* module.c (MOD_VERSION): Bump module version.
(mio_component): Treat formal arguments.
(mio_formal_arglist): Changed argument from gfc_symbol to
gfc_formal_arglist.
(mio_symbol): Changed argument of mio_formal_arglist.
* resolve.c (resolve_ppc_call,resolve_expr_ppc): Call gfc_ppc_use,
to check actual arguments and treat formal args correctly.
(resolve_fl_derived): Copy formal args of procedure pointer components
from their interface.
* symbol.c (gfc_copy_formal_args_ppc): New function, analogous to
gfc_copy_formal_args, but for procedure pointer components.
2009-06-24 Janus Weil <janus@gcc.gnu.org>
PR fortran/40427
* gfortran.dg/proc_ptr_comp_11.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148906 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r-- | gcc/fortran/interface.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index c6da6f880dd..c03c06e364c 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2397,6 +2397,50 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) } +/* Check how a procedure pointer component is used against its interface. + If all goes well, the actual argument list will also end up being properly + sorted. Completely analogous to gfc_procedure_use. */ + +void +gfc_ppc_use (gfc_component *comp, gfc_actual_arglist **ap, locus *where) +{ + + /* Warn about calls with an implicit interface. Special case + for calling a ISO_C_BINDING becase c_loc and c_funloc + are pseudo-unknown. */ + if (gfc_option.warn_implicit_interface + && comp->attr.if_source == IFSRC_UNKNOWN + && !comp->attr.is_iso_c) + gfc_warning ("Procedure pointer component '%s' called with an implicit " + "interface at %L", comp->name, where); + + if (comp->attr.if_source == IFSRC_UNKNOWN) + { + gfc_actual_arglist *a; + for (a = *ap; a; a = a->next) + { + /* Skip g77 keyword extensions like %VAL, %REF, %LOC. */ + if (a->name != NULL && a->name[0] != '%') + { + gfc_error("Keyword argument requires explicit interface " + "for procedure pointer component '%s' at %L", + comp->name, &a->expr->where); + break; + } + } + + return; + } + + if (!compare_actual_formal (ap, comp->formal, 0, comp->attr.elemental, where)) + return; + + check_intents (comp->formal, *ap); + if (gfc_option.warn_aliasing) + check_some_aliasing (comp->formal, *ap); +} + + /* Try if an actual argument list matches the formal list of a symbol, respecting the symbol's attributes like ELEMENTAL. This is used for GENERIC resolution. */ |