diff mbox

[Fortran] PR 58470: [4.9 Regression] [OOP] ICE on invalid with FINAL procedure and type extension

Message ID CAKwh3qhLz1DCpegPbfjfK-4cw_z2Dbh6iLCr8bELCMTk8b7uyQ@mail.gmail.com
State New
Headers show

Commit Message

Janus Weil Feb. 6, 2014, 10:43 a.m. UTC
Hi all,

attached is a small patch which fixes an ICE-on-invalid regression
with finalization. In the PR, Dominique objected to the patch, but I
think it's the correct thing to do after all. The line that I'm
removing was added in a patch authored by Tobias and myself. I suspect
it was added to work around some other problem in the finalization
implementation, and there is no evidence it's actually needed.

The patch regtests cleanly on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


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

    PR fortran/58470
    * resolve.c (resolve_fl_derived0): Remove unnecessary call to
    gfc_is_finalizable.


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

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

Comments

Mikael Morin Feb. 6, 2014, 8:17 p.m. UTC | #1
Le 06/02/2014 11:43, Janus Weil a écrit :
> Hi all,
> 
> attached is a small patch which fixes an ICE-on-invalid regression
> with finalization. In the PR, Dominique objected to the patch, but I
> think it's the correct thing to do after all. The line that I'm
> removing was added in a patch authored by Tobias and myself. I suspect
> it was added to work around some other problem in the finalization
> implementation, and there is no evidence it's actually needed.
> 
> The patch regtests cleanly on x86_64-unknown-linux-gnu. Ok for trunk?
> 
Wait a bit; let's try to understand the problem.

Normally I would say calling gfc_is_finalizable here in
resolve_fl_derived0 is harmless because gfc_resolve_finalizers has been
called before in resolve_fl_derived.
BUT:
resolve_fl_derived0 recurses on its parent type, while
gfc_resolve_finalizers doesn't; and in this case we end up recursing on
type "cfml" whose finalizers haven't been resolved yet.

Now whether your patch is the right thing to do... I'm a bit skeptical
about removing the one use of gfc_is_finalizable in resolve.c . On the
other hand it is regression free...
I'll think about it and try to come back to you tomorrow or so.

Mikael
diff mbox

Patch

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(revision 207485)
+++ gcc/fortran/resolve.c	(working copy)
@@ -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;
 }