Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Should the dummy argument of an ELEMENTAL procedure be allowed to have an ALLOCATABLE attribute ?

FortranFan
Honored Contributor III
1,257 Views

Dear Steve et al. at Intel,

The code listed below compiles with no errors or warnings using Intel Fortran compiler version 13.1.0.149 even if Fortran 2003/2008 standards checking is turned on.  This seems to be a violation of C1277 of Fortran 2003 standard that says:

[plain]

 

8 12.7 Elemental procedures

 

9 12.7.1 Elemental procedure declaration and interface

 

10 An elemental procedure is an elemental intrinsic procedure or a procedure that is defined by an

11 elemental subprogram.

 

12 An elemental subprogram has the prefix-spec ELEMENTAL. An elemental subprogram is a pure sub

13 program. The PURE prefix-spec need not appear; it is implied by the ELEMENTAL prefix-spec. The

14 following additional constraints apply to elemental subprograms.

 

15 C1277 All dummy arguments of an elemental procedure shall be scalar dummy data objects and shall

16 not have the POINTER or ALLOCATABLE attribute.

 

17 C1278 The result variable of an elemental function shall be scalar and shall not have the POINTER or ALLOCATABLE attribute.

 

[/plain]

 

Can you please review and follow-up as you think is appropriate?  Perhaps it has been fixed in compiler 14, the latest update?

[fortran]

   MODULE foo

 

      TYPE t

      END TYPE t

 

   CONTAINS

 

      PURE ELEMENTAL SUBROUTINE foo1(x)

 

         TYPE(t), ALLOCATABLE, INTENT(INOUT) :: x

 

      END SUBROUTINE foo1

 

      PURE ELEMENTAL SUBROUTINE foo2(x)

 

         TYPE(t), ALLOCATABLE, INTENT(OUT) :: x

 

      END SUBROUTINE foo2

 

      PURE ELEMENTAL SUBROUTINE foo3(x)

 

         TYPE(t), ALLOCATABLE, INTENT(IN) :: x

 

      END SUBROUTINE foo3

 

   END MODULE foo

 

[/fortran]

 

0 Kudos
9 Replies
FortranFan
Honored Contributor III
1,257 Views

Note Intel Fortran compiler version 13.1.0.149 correctly throws an error if the dummy argument attribute is POINTER instead of ALLOCATABLE.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,257 Views

In your case, the allocatable object is a scalar (one of your type t).

Line 17 C1278 The result variable of an elemental function shall be scalar and shall not have the POINTER or ALLOCATABLE attribute.

Your program is using elemental subroutine.

Jim Dempsey

0 Kudos
FortranFan
Honored Contributor III
1,257 Views

Jim,

You're referring to item C1278 starting on line 17 that refers to the result variable of an ELEMENTAL function.

Instead it is item C1277 starting on line 15 that applies to my code example.  Note it says:

[plain]

15 C1277 All dummy arguments of an elemental procedure shall be scalar dummy data objects and shall

14

16 not have the POINTER or ALLOCATABLE attribute.

[/plain]

0 Kudos
Steven_L_Intel1
Employee
1,257 Views

Thanks for bringing this to our attention. My guess is that it was missed a long time ago when we added allocatable dummy arguments. I will let the developers know.

0 Kudos
Steven_L_Intel1
Employee
1,257 Views

It turns out that this was reported a little while ago and is on the list to be fixed. Issue ID is DPD200247686.

0 Kudos
FortranFan
Honored Contributor III
1,257 Views

Steve,

Thanks much for following up on this.  Any word on the timing for the fix?

 

0 Kudos
Steven_L_Intel1
Employee
1,257 Views

No word. It won't be before the next major release later this year.

0 Kudos
Steven_L_Intel1
Employee
1,257 Views

This has been fixed for 15.0 Update 2, available now from the Intel Registration Center.

0 Kudos
FortranFan
Honored Contributor III
1,257 Views

Awesome, thank you.

0 Kudos
Reply