This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] PR58356 - fix ICE with finalizer in type extension


A rather obvious patch.

Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias
2013-09-15  Tobias Burnus  <burnus@net-b.de>

	PR fortran/58356
	* class.c (generate_finalization_wrapper): Init proc_tree if
	not yet resolved.

2013-09-15  Tobias Burnus  <burnus@net-b.de>

	PR fortran/58356
	* gfortran.dg/finalize_19.f90: New.

diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 629b052..7117e83 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -1881,6 +1881,8 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns,
 
       for (fini = derived->f2k_derived->finalizers; fini; fini = fini->next)
 	{
+	  if (!fini->proc_tree)
+	    fini->proc_tree = gfc_find_sym_in_symtree (fini->proc_sym);
 	  if (fini->proc_tree->n.sym->attr.elemental)
 	    {
 	      fini_elem = fini;
diff --git a/gcc/testsuite/gfortran.dg/finalize_19.f90 b/gcc/testsuite/gfortran.dg/finalize_19.f90
new file mode 100644
index 0000000..1eeb6af
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/finalize_19.f90
@@ -0,0 +1,21 @@
+! { dg-do compile }
+!
+! PR fortran/58356
+!
+! Contributed by Andrew Benson
+!
+module ct
+  type :: cfl
+   contains
+     final :: cfld
+  end type cfl
+  type, extends(cfl) :: cfde
+   contains
+  end type cfde
+contains
+  subroutine cfld(self)
+    implicit none
+    type(cfl), intent(inout) :: self
+    return
+  end subroutine cfld
+end module ct

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]