[Bug fortran/101658] New: Bogus message for declaration of polymorphic dummy argument
longb at cray dot com
gcc-bugzilla@gcc.gnu.org
Wed Jul 28 18:09:59 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101658
Bug ID: 101658
Summary: Bogus message for declaration of polymorphic dummy
argument
Product: gcc
Version: 10.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: longb at cray dot com
Target Milestone: ---
For this code:
> cat test2.f90
module test_module
use, intrinsic:: iso_fortran_env, only: int32
implicit none
type, abstract :: hash_base_t
contains
procedure, nopass:: hash => dhash
end type
type, extends(hash_base_t), public:: hash_t(len)
integer(kind=int32), len:: len=1
contains
procedure:: get_len
final:: finalise_hash
end type
contains
pure elemental integer function dhash(key, start)
character(len=*), intent(in):: key
integer(kind=int32), intent(in), optional:: start
dhash = 1
end function dhash
pure integer function get_len(this)
class(hash_t( * )), intent(in):: this
get_len = this%len
end function get_len
subroutine finalise_hash(this)
class(hash_t( * )), intent(inout):: this
end subroutine finalise_hash
end module test_module
gfortran give this set of errors:
> gfortran -c test2.f90
test2.f90:30:31:
30 | subroutine finalise_hash(this)
| 1
Error: Argument of FINAL procedure at (1) must be of type 'hash_t'
test2.f90:26:22:
26 | class(hash_t( * )), intent(in):: this
| 1
Error: 'hash_base_t' at (1) is of the ABSTRACT type 'hash_base_t'
test2.f90:26:22:
26 | class(hash_t( * )), intent(in):: this
| 1
Error: 'hash_base_t' at (1) is of the ABSTRACT type 'hash_base_t'
test2.f90:26:22:
26 | class(hash_t( * )), intent(in):: this
| 1
Error: 'hash_base_t' at (1) is of the ABSTRACT type 'hash_base_t'
> gfortran --version
GNU Fortran (GCC) 10.3.0 20210408 (Cray Inc.)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The type of the argument is hash_t, and not hash_base_t. Maybe getting confused
because hash_t is parameterized??
More information about the Gcc-bugs
mailing list