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

Wrong error when the actual argument of a procedure is a coarray component

FlyingHermes
New Contributor I
271 Views

The following code generates a compile-time error but I think the code is correct.

Here is the code:

Program Main

  implicit none

  Type :: MyType
    real(8) ,allocatable ,codimension[:] :: CoVar
  End Type

  type(MyType)  ::      Object

! The following line cause a compile-time error with ifort version 15.0.4
  Object%CoVar       =       CoMinVal( Object%CoVar )   ! main.f90(12): error #8396: If the dummy argument is a coarray, the corresponding actual argument must be a coarray and must have the VOLATILE attribute if and only if the dummy argument has the VOLATILE attribute.   [COVAR]

  associate( CoVar => Object%CoVar )
   CoVar        =       CoMinVal( CoVar )
  end associate

  contains

  Pure Function CoMinVal( CoVar ) result(VarMin)
    real(8) ,codimension
  • ,intent(in) :: CoVar real(8) :: VarMin integer :: iImg VarMin = CoVar do iImg = This_image()+1,Num_images() VarMin = min( VarMin, CoVar[iImg] ) end do do iImg = 1,This_image()-1 VarMin = min( VarMin, CoVar[iImg] ) end do End Function End Program
  • and the compilation output is:

    $ ifort -v && ifort -coarray main.f90 
    ifort version 15.0.4
    main.f90(12): error #8396: If the dummy argument is a coarray, the corresponding actual argument must be a coarray and must have the VOLATILE attribute if and only if the dummy argument has the VOLATILE attribute.   [COVAR]
      Object%CoVar       =       CoMinVal( Object%CoVar )   ! main.f90(12): error #8396: If the dummy argument is a coarray, the corresponding actual argument must be a coarray and must have the VOLATILE attribute if and only if the dummy argument has the VOLATILE attribute.   [COVAR]
    ----------------------------------------------^
    compilation aborted for main.f90 (code 1)

    Note that a workaround consists of using an associate block

    0 Kudos
    3 Replies
    FlyingHermes
    New Contributor I
    271 Views

    Any updates on this one ?

    0 Kudos
    Steven_L_Intel1
    Employee
    271 Views

    Sorry, looks as if we overlooked it. I see it still fails in 17.0.1 and will report it to the developers tomorrow.

    0 Kudos
    Steven_L_Intel1
    Employee
    271 Views

    Escalated as issue DPD200416774 - sorry for missing this.

    0 Kudos
    Reply