This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, Fortran] ICE with PROCEDURE using a complicated interface (PR36322 & PR36275)
- From: "Janus Weil" <jaydub66 at googlemail dot com>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "Tobias Burnus" <burnus at net-b dot de>
- Date: Tue, 3 Jun 2008 19:21:33 +0200
- Subject: [Patch, Fortran] ICE with PROCEDURE using a complicated interface (PR36322 & PR36275)
Hi all,
here is a new version of my fix for those two bugs, which I have not
committed together with PR36361 yesterday after having some doubts. I
changed the patch again now, so that not just the pointer to "ts" is
copied (which would result in two symbols pointing to the same ts),
but all elements of ts are copied one by one. I'm not sure if the
other method would really cause trouble (at least it passed the
testsuite), but it think this is safer now.
Regtested without any failures. Ok for trunk?
Cheers,
Janus
2008-06-03 Janus Weil <janus@gcc.gnu.org>
PR fortran/36322
PR fortran/36275
* resolve.c (resolve_symbol): Correctly copy the interface for a
PROCEDURE declaration.
2008-06-02 Janus Weil <janus@gcc.gnu.org>
PR fortran/36322
PR fortran/36275
* gfortran.dg/proc_decl_2.f90: Extended.
Index: gcc/testsuite/gfortran.dg/proc_decl_2.f90
===================================================================
--- gcc/testsuite/gfortran.dg/proc_decl_2.f90 (revision 136309)
+++ gcc/testsuite/gfortran.dg/proc_decl_2.f90 (working copy)
@@ -4,16 +4,27 @@
module m
+ use ISO_C_BINDING
+
abstract interface
subroutine csub() bind(c)
end subroutine csub
end interface
+ integer, parameter :: ckind = C_FLOAT_COMPLEX
+ abstract interface
+ function stub() bind(C)
+ import ckind
+ complex(ckind) stub
+ end function
+ end interface
+
procedure():: mp1
procedure(real), private:: mp2
procedure(mfun), public:: mp3
procedure(csub), public, bind(c) :: c, d
procedure(csub), public, bind(c, name="myB") :: b
+ procedure(stub), bind(C) :: e
contains
@@ -32,6 +43,15 @@ contains
procedure(a), optional :: b
end subroutine bar
+ subroutine bar2(x)
+ abstract interface
+ character function abs_fun()
+ end function
+ end interface
+ procedure(abs_fun):: x
+ end subroutine
+
+
end module
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 136309)
+++ gcc/fortran/resolve.c (working copy)
@@ -7895,6 +7895,11 @@ resolve_symbol (gfc_symbol *sym)
{
sym->ts.type = sym->ts.interface->ts.type;
sym->ts.kind = sym->ts.interface->ts.kind;
+ sym->ts.derived = sym->ts.interface->ts.derived;
+ sym->ts.cl = sym->ts.interface->ts.cl;
+ sym->ts.is_c_interop = sym->ts.interface->ts.is_c_interop;
+ sym->ts.is_iso_c = sym->ts.interface->ts.is_iso_c;
+ sym->ts.f90_type = sym->ts.interface->ts.f90_type;
sym->attr.function = sym->ts.interface->attr.function;
sym->attr.subroutine = sym->ts.interface->attr.subroutine;
copy_formal_args (sym, sym->ts.interface);