From c79bb35514fb9ed2a63277bad7e71f0dd41664d7 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Wed, 9 Feb 2011 23:59:02 +0100 Subject: re PR fortran/47352 ([F03] ICE with proc-pointers in generic procedures) 2011-02-09 Janus Weil PR fortran/47352 * resolve.c (resolve_procedure_interface): If interface has a result variable, copy the typespec and set result pointer to self. 2011-02-09 Janus Weil PR fortran/47352 * gfortran.dg/proc_decl_25.f90: New. From-SVN: r169987 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/resolve.c | 5 ++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/proc_decl_25.f90 | 22 ++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/proc_decl_25.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6475d5e..80cc4da 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,11 @@ 2011-02-09 Janus Weil + PR fortran/47352 + * resolve.c (resolve_procedure_interface): If interface has a result + variable, copy the typespec and set result pointer to self. + +2011-02-09 Janus Weil + PR fortran/47463 * resolve.c (resolve_typebound_subroutine): Remove erroneous line. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 688967a..0fe0672 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -160,7 +160,10 @@ resolve_procedure_interface (gfc_symbol *sym) resolve_intrinsic (ifc, &ifc->declared_at); if (ifc->result) - sym->ts = ifc->result->ts; + { + sym->ts = ifc->result->ts; + sym->result = sym; + } else sym->ts = ifc->ts; sym->ts.interface = ifc; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9725a49..e68a483 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2011-02-09 Janus Weil + PR fortran/47352 + * gfortran.dg/proc_decl_25.f90: New. + +2011-02-09 Janus Weil + PR fortran/47463 * gfortran.dg/typebound_assignment_2.f03: New. diff --git a/gcc/testsuite/gfortran.dg/proc_decl_25.f90 b/gcc/testsuite/gfortran.dg/proc_decl_25.f90 new file mode 100644 index 0000000..b455911 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_decl_25.f90 @@ -0,0 +1,22 @@ +! { dg-do compile } +! +! PR 47352: [F03] ICE with proc-pointers in generic procedures +! +! Contributed by James van Buskirk +! cf. http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/bbaf59ffd7c372e9 + + implicit none + + abstract interface + real function f() + end function f + end interface + + procedure(f) :: f1 + + interface gen + procedure f1 + end interface gen + + write(*,*) gen() +end -- cgit v1.1