Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Coarrays and defined assignment

Nick_M_3
New Contributor I
317 Views

I don't think that this is right!  It's not polymorphic ....

MODULE Assign
    IMPLICIT NONE
    INTEGER :: factor
    TYPE, PUBLIC :: Mytype
        INTEGER :: comp = 123
    CONTAINS
        PROCEDURE, PRIVATE :: Copy
        GENERIC :: ASSIGNMENT (=) => Copy
    END TYPE Mytype
CONTAINS
    PURE SUBROUTINE Copy (a, b)
        CLASS(Mytype), INTENT(OUT) :: a
        CLASS(Mytype), INTENT(IN) :: b
        a%comp = b%comp*factor
    END SUBROUTINE Copy
END MODULE Assign

PROGRAM Main
    USE Assign
    IMPLICIT NONE
    TYPE(Mytype) :: coarray


  •     factor = THIS_IMAGE()
        SYNC ALL
        IF (THIS_IMAGE() == 1) THEN
            coarray = coarray[2]       ! (a)
            coarray[3] = coarray       ! (b)
            coarray[4] = coarray[5]    ! (c)
        END IF
    END PROGRAM Main
  • ifort version 14.0.2

    gerbil.f90(25): error #8392: If the actual argument is a polymorphic coindexed object, the dummy argument must not be polymorphic.   [COARRAY]
            coarray = coarray[2]       ! (a)
    ------------------^
    gerbil.f90(26): error #8392: If the actual argument is a polymorphic coindexed object, the dummy argument must not be polymorphic.   [COARRAY]
            coarray[3] = coarray       ! (b)
    --------^
    gerbil.f90(27): error #8392: If the actual argument is a polymorphic coindexed object, the dummy argument must not be polymorphic.   [COARRAY]
            coarray[4] = coarray[5]    ! (c)
    --------^
    gerbil.f90(27): error #8392: If the actual argument is a polymorphic coindexed object, the dummy argument must not be polymorphic.   [COARRAY]
            coarray[4] = coarray[5]    ! (c)
    ---------------------^
    compilation aborted for gerbil.f90 (code 1)

     

     

    0 Kudos
    2 Replies
    Steven_L_Intel1
    Employee
    317 Views

    Hi, Nick.

    I agree with you that this error message is unwarranted. I'll note that defined assignment, per se, isn't relevant as you can see the same issue if you call Copy directly. I have escalated this as issue DPD200359259 and will let you know of any progress.

    0 Kudos
    Steven_L_Intel1
    Employee
    317 Views

    We fixed the error message, but then found that the call doesn't work correctly. Working on that one....

    0 Kudos
    Reply