This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: [PATCH, Fortran] Parse FINAL procedure declarations


Daniel Kraft wrote:
Well, he just agreed it would be a good idea to write non-scalar FINAL procedures with assumed shape argument.

An alternative are ELEMENTAL subroutines; in that case you do not need an array version.


That we could warn about this was an idea from me (I'll have to look at the standard more closely what happens if an explicit shape is given and an array of another shape is to be finalized... As far as I remember it just stated "find a procedure matching in rank and kind and call it" so that would imply call it anyways?

My understanding is for arrays:
- First search a FINAL procedure with a matching rank; when found one, call it.
- Otherwise: If there is an ELEMENTAL finalization subroutine, call it.
- Otherwise: Do not call anything


Analogously for scalars: Is there a scalar version, call it, otherwise don't do anything.

I like the idea of warning if there is no scalar version or no array version and the scalar is not elemental. However, I'm not sure whether the warning needs there by default or only with -Wsurprising.

BTW, I forgot yesterday before check-in we should probably add a warning/error on FINAL "FINAL procedures not yet implemented" (thanks Tobias for the suggestion).

If you add it after all the error checking, the testcase files only need a ! { dg-error "not implemented" } and should otherwise work. I think one can use
! { dg-error "one message | second message" }
if there are multiple errors in one line.


Tobias


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