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

protected procedure pointer

MR
Beginner
615 Views
When compiling the attached code with ifort I get:

error #8171: This is not a valid attribute for the procedure declaration statement. [PROTECTED]
procedure(i_f), pointer, protected :: p_f => null()
--------------------------^
compilation aborted for protected-procpointers.f90 (code 1)

However, from the standard I see

C535 (R501) The PROTECTED attribute is permitted only for a
procedure pointer or named variable that is not in a common block.

so I think that the code is fine.

ifort -V
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20100414 Package ID: l_cprof_p_11.1.072
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.

module m
implicit none
abstract interface
pure function i_f(x) result(y)
real, intent(in) :: x
real :: y
end function i_f
end interface
!procedure(i_f), pointer :: p_f => null() ! this works
procedure(i_f), pointer, protected :: p_f => null()
end module m

0 Kudos
4 Replies
Steven_L_Intel1
Employee
615 Views
I agree that your code is legal and that the compiler should accept this. I'll report it to the developers. The issue ID is DPD200156432.
0 Kudos
MR
Beginner
615 Views
OK, thank you!

Marco
0 Kudos
Steven_L_Intel1
Employee
615 Views
Marco,

The standards committee realized that the standard did not have appropriate wording regarding the PROCEDURE statement to allow this usage, but it was intended that it should work. An interpretation has been filed and we'll fix the compiler.
0 Kudos
Steven_L_Intel1
Employee
615 Views
I expect this to be fixed in the next major release, scheduled for November.
0 Kudos
Reply