Coarrays and defined assignment

Coarrays and defined assignment

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)

 

 

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Steve - Intel Developer Support

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

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today