aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2009-07-13 15:41:37 +0200
committerJanus Weil <janus@gcc.gnu.org>2009-07-13 15:41:37 +0200
commitacbdc378b68627af9126064e556981989cff13c3 (patch)
tree5a7bba20ef265a3d6d5893b9a44c4302063875a2 /gcc/fortran
parentae525aa88f6af6131501a6171e3ee62e6b981b51 (diff)
downloadgcc-acbdc378b68627af9126064e556981989cff13c3.zip
gcc-acbdc378b68627af9126064e556981989cff13c3.tar.gz
gcc-acbdc378b68627af9126064e556981989cff13c3.tar.bz2
re PR fortran/40646 ([F03] array-valued procedure pointer components)
2009-07-13 Janus Weil <janus@gcc.gnu.org> PR fortran/40646 * module.c (mio_symbol): If the symbol has formal arguments, the formal namespace will be present. * resolve.c (resolve_actual_arglist): Correctly handle 'called' procedure pointer components as actual arguments. (resolve_fl_derived,resolve_symbol): Make sure the formal namespace is present. * trans-expr.c (gfc_conv_procedure_call): Correctly handle the formal arguments of procedure pointer components. 2009-07-13 Janus Weil <janus@gcc.gnu.org> PR fortran/40646 * gfortran.dg/proc_ptr_22.f90: Extended. * gfortran.dg/proc_ptr_comp_12.f90: Extended. From-SVN: r149586
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog12
-rw-r--r--gcc/fortran/module.c13
-rw-r--r--gcc/fortran/resolve.c29
-rw-r--r--gcc/fortran/trans-expr.c5
4 files changed, 45 insertions, 14 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2206931..6eabe0da 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,15 @@
+2009-07-13 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40646
+ * module.c (mio_symbol): If the symbol has formal arguments,
+ the formal namespace will be present.
+ * resolve.c (resolve_actual_arglist): Correctly handle 'called'
+ procedure pointer components as actual arguments.
+ (resolve_fl_derived,resolve_symbol): Make sure the formal namespace
+ is present.
+ * trans-expr.c (gfc_conv_procedure_call): Correctly handle the formal
+ arguments of procedure pointer components.
+
2009-07-12 Tobias Burnus <burnus@net-b.de>
Philippe Marguinaud <philippe.marguinaud@meteo.fr>
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 7e6e8ff..aa08c2c 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3439,19 +3439,8 @@ mio_symbol (gfc_symbol *sym)
mio_symbol_attribute (&sym->attr);
mio_typespec (&sym->ts);
- /* Contained procedures don't have formal namespaces. Instead we output the
- procedure namespace. The will contain the formal arguments. */
if (iomode == IO_OUTPUT)
- {
- formal = sym->formal;
- while (formal && !formal->sym)
- formal = formal->next;
-
- if (formal)
- mio_namespace_ref (&formal->sym->ns);
- else
- mio_namespace_ref (&sym->formal_ns);
- }
+ mio_namespace_ref (&sym->formal_ns);
else
{
mio_namespace_ref (&sym->formal_ns);
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 9b091ad..880dfd0 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1239,7 +1239,14 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype,
if (gfc_is_proc_ptr_comp (e, &comp))
{
e->ts = comp->ts;
- e->expr_type = EXPR_VARIABLE;
+ if (e->value.compcall.actual == NULL)
+ e->expr_type = EXPR_VARIABLE;
+ else
+ {
+ if (comp->as != NULL)
+ e->rank = comp->as->rank;
+ e->expr_type = EXPR_FUNCTION;
+ }
goto argument_list;
}
@@ -8993,6 +9000,9 @@ ensure_not_abstract (gfc_symbol* sub, gfc_symbol* ancestor)
}
+static void resolve_symbol (gfc_symbol *sym);
+
+
/* Resolve the components of a derived type. */
static gfc_try
@@ -9031,6 +9041,9 @@ resolve_fl_derived (gfc_symbol *sym)
{
gfc_symbol *ifc = c->ts.interface;
+ if (ifc->formal && !ifc->formal_ns)
+ resolve_symbol (ifc);
+
if (ifc->attr.intrinsic)
resolve_intrinsic (ifc, &ifc->declared_at);
@@ -9832,6 +9845,20 @@ resolve_symbol (gfc_symbol *sym)
if (sym->formal_ns && sym->formal_ns != gfc_current_ns)
gfc_resolve (sym->formal_ns);
+ /* Make sure the formal namespace is present. */
+ if (sym->formal && !sym->formal_ns)
+ {
+ gfc_formal_arglist *formal = sym->formal;
+ while (formal && !formal->sym)
+ formal = formal->next;
+
+ if (formal)
+ {
+ sym->formal_ns = formal->sym->ns;
+ sym->formal_ns->refs++;
+ }
+ }
+
/* Check threadprivate restrictions. */
if (sym->attr.threadprivate && !sym->attr.save && !sym->ns->save_all
&& (!sym->attr.in_common
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index b6a825a..787251d 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -2560,7 +2560,10 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
!= EXPR_CONSTANT)
|| (comp && comp->attr.dimension)
|| (!comp && sym->attr.dimension));
- formal = sym->formal;
+ if (comp)
+ formal = comp->formal;
+ else
+ formal = sym->formal;
/* Evaluate the arguments. */
for (; arg != NULL; arg = arg->next, formal = formal ? formal->next : NULL)
{