https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70312
Bug ID: 70312 Summary: Spurious -Wsurprising warnings for final subroutines Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: neil.n.carlson at gmail dot com Target Milestone: --- -Wsurprising issues spurious warnings about final procedures. module foo_type type foo contains final :: foo_delete end type contains subroutine foo_delete (this) type(foo), intent(inout) :: this end subroutine end module program main use foo_type end program Compiling with "gfortran -Wsurprising" gives: gfortran-bug-20160319.f90:13:6: use foo_type 1 Warning: Only array FINAL procedures declared for derived type ‘foo’ defined at (1), suggest also scalar one [-Wsurprising] But the final subroutine was a scalar one. Perhaps the intended message was "Only scalar FINAL ..., suggest also array one"? Making the subroutine elemental elemental subroutine foo_delete (this) type(foo), intent(inout) :: this(:) end subroutine gives the same warning message, which is also incorrect. Aside from issuing only valid warning messages, the larger question is how thorough should -Wsurprising be. Apart from an elemental final subroutine, one needs to be provided for scalar and *every* possible rank of array in order to ensure all possibilities are covered. Should -Wsurprising be warning for each and every missing one?