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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149586
138bc75d-0d04-0410-961f-
82ee72b054a4
+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>
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);
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;
}
}
+static void resolve_symbol (gfc_symbol *sym);
+
+
/* Resolve the components of a derived type. */
static gfc_try
{
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);
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
!= 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)
{
+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.
+
2009-07-13 Ira Rosen <irar@il.ibm.com>
* gfortran.dg/vect/vect-6.f: New test.
module bugTestMod
implicit none
+ procedure(returnMat), pointer :: pp2
contains
function returnMat( a, b ) result( mat )
integer:: a, b
procedure(returnMat), pointer :: pp
pp => returnMat
if (sum(pp(2,2))/=4) call abort()
+ pp2 => returnMat
+ if (sum(pp2(3,2))/=6) call abort()
end program bugTest
! { dg-final { cleanup-modules "bugTestMod" } }
testCatch = testObj%test(2,2)
print *,testCatch
if (sum(testCatch)/=4) call abort()
+ print *,testObj%test(3,3)
+ if (sum(testObj%test(3,3))/=9) call abort()
end program bugTest
! { dg-final { cleanup-modules "bugTestMod" } }