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

            Bug ID: 92122
           Summary: [coarrays, polymophism] Error 'must be a scalar of
                    type LOCK_TYPE'
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: pault at gcc dot gnu.org
  Target Milestone: ---

From thread starting at
   https://mailman.j3-fortran.org/pipermail/j3/2019-October/011681.html
The issue there is not yet fully triaged at J3.

But the thread comes with two example programs – shown below.
- the first one is the original one
- the second one is a modified program, which compiles with the Intel compiler

With gfortran, the error messages are:

    5 |     Type(lock_type),Pointer :: q
      |                                1
Error: Component q at (1) of type LOCK_TYPE must have a codimension or be a
subcomponent of a coarray, which is not possible as the component has the
pointer attribute

And:

   11 |       type is ( lock_type )
      |                           1
Error: Variable __tmp_type_lock_type at (1) of type LOCK_TYPE or with
subcomponent of type LOCK_TYPE must be a coarray

The latter also exposes the tmp variable name, which is also not that nice.


!----------- One -------------
Program co428
  Use Iso_Fortran_Env
  Type(lock_type),Target :: p[*]
  Type lockpointer
    Type(lock_type),Pointer :: q
  End Type
  Type(lockpointer) x

  x%q => p
  Lock(x%q)
  Print *,'Is this really ok?'
End Program


!----------- Two -------------
   use, intrinsic :: iso_fortran_env, only : lock_type

   type :: lock_t
       class(*), pointer :: q
   end type
   type(lock_type), target :: p[*]
   type(lock_t) :: x

   x%q => p
   select type ( q => x%q )
      type is ( lock_type )
         lock( q )
   end select
end

Reply via email to