re PR fortran/58470 ([OOP] ICE on invalid with FINAL procedure and type extension)
authorJanus Weil <janus@gcc.gnu.org>
Sat, 8 Feb 2014 21:32:25 +0000 (22:32 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Sat, 8 Feb 2014 21:32:25 +0000 (22:32 +0100)
2014-02-08  Janus Weil  <janus@gcc.gnu.org>
    Mikael Morin <mikael.morin@gcc.gnu.org>

PR fortran/58470
* class.c (generate_finalization_wrapper): Assert that proc_tree has
been set in gfc_resolve_finalizers.
* resolve.c (resolve_fl_derived0): Remove unnecessary call to
gfc_is_finalizable.

2014-02-08  Janus Weil  <janus@gcc.gnu.org>

PR fortran/58470
* gfortran.dg/finalize_22.f90: New.

Co-Authored-By: Mikael Morin <mikael@gcc.gnu.org>
From-SVN: r207636

gcc/fortran/ChangeLog
gcc/fortran/class.c
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/finalize_22.f90 [new file with mode: 0644]

index 79f2074..052248c 100644 (file)
@@ -1,3 +1,12 @@
+2014-02-08  Janus Weil  <janus@gcc.gnu.org>
+           Mikael Morin <mikael.morin@gcc.gnu.org>
+
+       PR fortran/58470
+       * class.c (generate_finalization_wrapper): Assert that proc_tree has
+       been set in gfc_resolve_finalizers.
+       * resolve.c (resolve_fl_derived0): Remove unnecessary call to
+       gfc_is_finalizable.
+
 2014-02-07  Benno Schulenberg  <bensberg@justemail.net>
 
        PR translation/52289
index d3569fd..8af9172 100644 (file)
@@ -1880,8 +1880,7 @@ 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);
+         gcc_assert (fini->proc_tree);   /* Should have been set in gfc_resolve_finalizers.  */
          if (fini->proc_tree->n.sym->attr.elemental)
            {
              fini_elem = fini;
index 898a0ae..0262165 100644 (file)
@@ -12455,10 +12455,6 @@ resolve_fl_derived0 (gfc_symbol *sym)
   /* Add derived type to the derived type list.  */
   add_dt_to_dt_list (sym);
 
-  /* Check if the type is finalizable. This is done in order to ensure that the
-     finalization wrapper is generated early enough.  */
-  gfc_is_finalizable (sym, NULL);
-
   return true;
 }
 
index 8448c42..9b9d2cd 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-08  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/58470
+       * gfortran.dg/finalize_22.f90: New.
+
 2014-02-08  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/60066
diff --git a/gcc/testsuite/gfortran.dg/finalize_22.f90 b/gcc/testsuite/gfortran.dg/finalize_22.f90
new file mode 100644 (file)
index 0000000..57fa6e7
--- /dev/null
@@ -0,0 +1,20 @@
+! { dg-do compile }
+!
+! PR 58470: [4.9 Regression] [OOP] ICE on invalid with FINAL procedure and type extension
+!
+! Contributed by Andrew Benson <abensonca@gmail.com>
+
+module cf
+  type  :: cfml
+   contains
+     final :: mld
+  end type cfml
+  type, extends(cfml) :: cfmde
+  end type cfmde
+contains
+  subroutine mld(s)   ! { dg-error "must be of type" }
+    class(cfml), intent(inout) :: s
+  end subroutine mld
+end module cf
+
+! { dg-final { cleanup-modules "cf" } }