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

--- Comment #18 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to anlauf from comment #14)
> The current solution is a bit annoying for implicitly-derived interfaces.
> 
> Consider a code like:
> 
> module foo
>   implicit none
>   type t1
>      integer :: i = 1
>   end type t1
>   type t2
>      integer :: j = 2
>   end type t2
> contains
>   subroutine s1 (x)
>     type(t1) :: x
>     call my_mpi_bcast_wrapper (x, storage_size (x)/8)
>   end subroutine s1
>   subroutine s2 (y)
>     type(t2) :: y
>     call my_mpi_bcast_wrapper (y, storage_size (y)/8)
>   end subroutine s2
> end module foo
> 
> That's perfectly legal,

This is illegal, as far as I know. The type names are different,
which makes them different types.

To quote 7.5.2.4  Determination of derived types

Two data entities have the same type if they are declared with reference to the
same derived-type definition. Data
entities also have the same type if they are declared with reference to
different derived-type definitions that specify
the same type name, all have the SEQUENCE attribute or all have the BIND
attribute, have no components
with PRIVATE accessibility, and have components that agree in order, name, and
attributes. Otherwise, they
are of different derived types.[...]

Reply via email to