public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "longb at cray dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/101658] New: Bogus message for declaration of polymorphic dummy argument
Date: Wed, 28 Jul 2021 18:09:59 +0000	[thread overview]
Message-ID: <bug-101658-4@http.gcc.gnu.org/bugzilla/> (raw)

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??

                 reply	other threads:[~2021-07-28 18:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101658-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).