aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2013-01-29 22:40:51 +0100
committerJanus Weil <janus@gcc.gnu.org>2013-01-29 22:40:51 +0100
commit4cbc9039962dd819f07ee1e3324696aea5114b00 (patch)
tree8a5b65f0f6e388374cf3665d4df237dbe7704a75 /gcc/fortran/interface.c
parentd6f2922e91928b5191a5c5f1b3a6b320712b5ce3 (diff)
downloadgcc-4cbc9039962dd819f07ee1e3324696aea5114b00.zip
gcc-4cbc9039962dd819f07ee1e3324696aea5114b00.tar.gz
gcc-4cbc9039962dd819f07ee1e3324696aea5114b00.tar.bz2
re PR fortran/54107 ([F03] Memory hog with abstract interface)
2013-01-29 Janus Weil <janus@gcc.gnu.org> Mikael Morin <mikael@gcc.gnu.org> PR fortran/54107 * gfortran.h (gfc_component): Delete members 'formal' and 'formal_ns'. (gfc_copy_formal_args,gfc_copy_formal_args_ppc,gfc_expr_replace_symbols, gfc_expr_replace_comp): Delete. (gfc_sym_get_dummy_args): New prototype. * dependency.c (gfc_check_fncall_dependency): Use 'gfc_sym_get_dummy_args'. * expr.c (gfc_is_constant_expr): Ditto. (replace_symbol,gfc_expr_replace_symbols,replace_comp, gfc_expr_replace_comp): Deleted. * frontend-passes.c (doloop_code,do_function): Use 'gfc_sym_get_dummy_args'. * interface.c (gfc_check_operator_interface,gfc_compare_interfaces, gfc_procedure_use,gfc_ppc_use,gfc_arglist_matches_symbol, gfc_check_typebound_override): Ditto. * module.c (MOD_VERSION): Bump module version. (mio_component): Do not read/write 'formal' and 'formal_ns'. * resolve.c (resolve_procedure_interface,resolve_fl_derived0): Do not copy formal args, but just keep a pointer to the interface. (resolve_function,resolve_call,resolve_typebound_generic_call, resolve_ppc_call,resolve_expr_ppc,generate_component_assignments, resolve_fl_procedure,gfc_resolve_finalizers,check_generic_tbp_ambiguity, resolve_typebound_procedure,check_uop_procedure): Use 'gfc_sym_get_dummy_args'. * symbol.c (free_components): Do not free 'formal' and 'formal_ns'. (gfc_copy_formal_args,gfc_copy_formal_args_ppc): Deleted. (gfc_sym_get_dummy_args): New function. * trans-array.c (get_array_charlen,gfc_walk_elemental_function_args): Use 'gfc_sym_get_dummy_args'. * trans-decl.c (build_function_decl,create_function_arglist, build_entry_thunks,init_intent_out_dt,gfc_trans_deferred_vars, add_argument_checking): Ditto. * trans-expr.c (gfc_map_fcn_formal_to_actual,gfc_conv_procedure_call, gfc_conv_statement_function): Ditto. * trans-stmt.c (gfc_conv_elemental_dependencies): Ditto. * trans-types.c (create_fn_spec,gfc_get_function_type): Ditto. 2013-01-29 Janus Weil <janus@gcc.gnu.org> Mikael Morin <mikael@gcc.gnu.org> PR fortran/54107 * gfortran.dg/proc_ptr_comp_36.f90: New. Co-Authored-By: Mikael Morin <mikael@gcc.gnu.org> From-SVN: r195562
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r--gcc/fortran/interface.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 9b0d1b9..fff8c39 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -616,7 +616,7 @@ gfc_check_operator_interface (gfc_symbol *sym, gfc_intrinsic_op op,
r1 = r2 = -1;
k1 = k2 = -1;
- for (formal = sym->formal; formal; formal = formal->next)
+ for (formal = gfc_sym_get_dummy_args (sym); formal; formal = formal->next)
{
gfc_symbol *fsym = formal->sym;
if (fsym == NULL)
@@ -662,6 +662,8 @@ gfc_check_operator_interface (gfc_symbol *sym, gfc_intrinsic_op op,
INTRINSIC_ASSIGN which should map to a subroutine. */
if (op == INTRINSIC_ASSIGN)
{
+ gfc_formal_arglist *dummy_args;
+
if (!sym->attr.subroutine)
{
gfc_error ("Assignment operator interface at %L must be "
@@ -674,12 +676,13 @@ gfc_check_operator_interface (gfc_symbol *sym, gfc_intrinsic_op op,
- First argument is a scalar and second an array,
- Types and kinds do not conform, or
- First argument is of derived type. */
- if (sym->formal->sym->ts.type != BT_DERIVED
- && sym->formal->sym->ts.type != BT_CLASS
+ dummy_args = gfc_sym_get_dummy_args (sym);
+ if (dummy_args->sym->ts.type != BT_DERIVED
+ && dummy_args->sym->ts.type != BT_CLASS
&& (r2 == 0 || r1 == r2)
- && (sym->formal->sym->ts.type == sym->formal->next->sym->ts.type
- || (gfc_numeric_ts (&sym->formal->sym->ts)
- && gfc_numeric_ts (&sym->formal->next->sym->ts))))
+ && (dummy_args->sym->ts.type == dummy_args->next->sym->ts.type
+ || (gfc_numeric_ts (&dummy_args->sym->ts)
+ && gfc_numeric_ts (&dummy_args->next->sym->ts))))
{
gfc_error ("Assignment operator interface at %L must not redefine "
"an INTRINSIC type assignment", &sym->declared_at);
@@ -1377,8 +1380,8 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2,
|| s2->attr.if_source == IFSRC_UNKNOWN)
return 1;
- f1 = s1->formal;
- f2 = s2->formal;
+ f1 = gfc_sym_get_dummy_args (s1);
+ f2 = gfc_sym_get_dummy_args (s2);
if (f1 == NULL && f2 == NULL)
return 1; /* Special case: No arguments. */
@@ -3107,6 +3110,8 @@ check_intents (gfc_formal_arglist *f, gfc_actual_arglist *a)
gfc_try
gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
{
+ gfc_formal_arglist *dummy_args;
+
/* Warn about calls with an implicit interface. Special case
for calling a ISO_C_BINDING becase c_loc and c_funloc
are pseudo-unknown. Additionally, warn about procedures not
@@ -3202,14 +3207,16 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
return SUCCESS;
}
- if (!compare_actual_formal (ap, sym->formal, 0, sym->attr.elemental, where))
+ dummy_args = gfc_sym_get_dummy_args (sym);
+
+ if (!compare_actual_formal (ap, dummy_args, 0, sym->attr.elemental, where))
return FAILURE;
- if (check_intents (sym->formal, *ap) == FAILURE)
+ if (check_intents (dummy_args, *ap) == FAILURE)
return FAILURE;
if (gfc_option.warn_aliasing)
- check_some_aliasing (sym->formal, *ap);
+ check_some_aliasing (dummy_args, *ap);
return SUCCESS;
}
@@ -3222,7 +3229,6 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
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. */
@@ -3250,12 +3256,13 @@ gfc_ppc_use (gfc_component *comp, gfc_actual_arglist **ap, locus *where)
return;
}
- if (!compare_actual_formal (ap, comp->formal, 0, comp->attr.elemental, where))
+ if (!compare_actual_formal (ap, comp->ts.interface->formal, 0,
+ comp->attr.elemental, where))
return;
- check_intents (comp->formal, *ap);
+ check_intents (comp->ts.interface->formal, *ap);
if (gfc_option.warn_aliasing)
- check_some_aliasing (comp->formal, *ap);
+ check_some_aliasing (comp->ts.interface->formal, *ap);
}
@@ -3266,16 +3273,19 @@ gfc_ppc_use (gfc_component *comp, gfc_actual_arglist **ap, locus *where)
bool
gfc_arglist_matches_symbol (gfc_actual_arglist** args, gfc_symbol* sym)
{
+ gfc_formal_arglist *dummy_args;
bool r;
gcc_assert (sym->attr.flavor == FL_PROCEDURE);
+ dummy_args = gfc_sym_get_dummy_args (sym);
+
r = !sym->attr.elemental;
- if (compare_actual_formal (args, sym->formal, r, !r, NULL))
+ if (compare_actual_formal (args, dummy_args, r, !r, NULL))
{
- check_intents (sym->formal, *args);
+ check_intents (dummy_args, *args);
if (gfc_option.warn_aliasing)
- check_some_aliasing (sym->formal, *args);
+ check_some_aliasing (dummy_args, *args);
return true;
}
@@ -4080,8 +4090,9 @@ gfc_check_typebound_override (gfc_symtree* proc, gfc_symtree* old)
if (!old->n.tb->nopass && !old->n.tb->pass_arg)
old_pass_arg = 1;
argpos = 1;
- for (proc_formal = proc_target->formal, old_formal = old_target->formal;
- proc_formal && old_formal;
+ proc_formal = gfc_sym_get_dummy_args (proc_target);
+ old_formal = gfc_sym_get_dummy_args (old_target);
+ for ( ; proc_formal && old_formal;
proc_formal = proc_formal->next, old_formal = old_formal->next)
{
if (proc->n.tb->pass_arg