[Patch, Fortran, OOP] PR 58175: Incorrect warning message on scalar finalizer
Janus Weil
janus@gcc.gnu.org
Mon Nov 28 13:36:00 GMT 2016
Hi all,
the attached patch was posted on bugzilla by Tobias three years ago,
but left unattended since then. It is simple, works well (fixing a
bogus warning) and regtests cleanly on x86_64-linux-gnu.
If no one objects, I will commit this to trunk by tomorrow.
Cheers,
Janus
2016-11-28 Tobias Burnus <burnus@net-b.de>
PR fortran/58175
* resolve.c (gfc_resolve_finalizers): Properly detect scalar finalizers.
2016-11-28 Janus Weil <janus@gcc.gnu.org>
PR fortran/58175
* gfortran.dg/finalize_30.f90: New test case.
-------------- next part --------------
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 242908)
+++ gcc/fortran/resolve.c (working copy)
@@ -12395,6 +12395,9 @@ gfc_resolve_finalizers (gfc_symbol* derived, bool
/* Skip this finalizer if we already resolved it. */
if (list->proc_tree)
{
+ if (list->proc_tree->n.sym->formal->sym->as == NULL
+ || list->proc_tree->n.sym->formal->sym->as->rank == 0)
+ seen_scalar = true;
prev_link = &(list->next);
continue;
}
@@ -12489,7 +12492,7 @@ gfc_resolve_finalizers (gfc_symbol* derived, bool
}
/* Is this the/a scalar finalizer procedure? */
- if (!arg->as || arg->as->rank == 0)
+ if (my_rank == 0)
seen_scalar = true;
/* Find the symtree for this procedure. */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: finalize_30.f90
Type: text/x-fortran
Size: 357 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161128/31bb482e/attachment.bin>
More information about the Gcc-patches
mailing list