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

[Bug fortran/86472] allocatable array, bound-procedure, submodule


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86472

--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> ---
Having now checked the standard, I have come to the belief that your
expectation that 't' will be associated in the procedure 'myfunc1' is
incorrect.

F2008 12.4.3.2 note 6 says:
"An interface body specifies all of the characteristics of the explicit
specific interface or abstract interface. The specification part of an
interface body may specify attributes or define values for data entities that
do not determine characteristics of the procedure. Such specifications have no
effect."

On the other hand, if 't' can be host associated from the parent module like
this:
Module M1
    implicit none

    type :: mytype
        contains
        procedure :: myfunc1
    end type

    real, allocatable :: t(:)

    interface

    module subroutine myfunc1(self, a)
        class(mytype), intent(in) :: self
        real, intent(in) :: a(:)
    end subroutine myfunc1
    end interface
End Module M1


submodule(M1) M2
    contains

    module procedure myfunc1
        allocate(t, source=a)
        x=10.0
        print *,t, a, x
    end procedure myfunc1
end submodule M2


In my opinion, this is not a bug. If any of the other brands accept your test
case, this is a non-standard feature.

Paul

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