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

PROTECTED attribute

Roman1
New Contributor I
922 Views

Hi,

When I compile the attached simple program with all diagnostic and error checking enabled, there are no messages displayed.  However, the program might be violating the Fortran standard.

From Fortran 2008 standard, page 100:

5.3.15 PROTECTED attribute

C551 A nonpointer object that has the PROTECTED attribute and is accessed by use association shall not
appear in a variable definition context  ....

Page 456:

16.6.7 Variable definition context

(12) an actual argument in a reference to a procedure with an explicit interface if the corresponding
 dummy argument has INTENT (OUT) or INTENT (INOUT);

Roman

0 Kudos
6 Replies
andrew_4619
Honored Contributor III
922 Views

Looks like a 6 legged critter to me but I will leave the verdict to others....

0 Kudos
Steven_L_Intel1
Employee
922 Views

I agree that the compiler should not have allowed this. I will report it to the developers - thanks. Issue ID is DPD200245966.

0 Kudos
Steven_L_Intel1
Employee
922 Views

We have fixed this for an update later this year.

0 Kudos
atru
Beginner
922 Views

Steve! Will a PROTECTED attribute work properly as you answered here –  http://software.intel.com/en-us/forums/topic/392997 according to this unfixed error?

0 Kudos
Steven_L_Intel1
Employee
922 Views

Yes, it should. The problem in this thread is that the compiler was inappropriately making an exception for passing a PROTECTED variable into a routine from the module where the variable was declared and where the routine declared the dummy argument as INTENT(OUT) or INTENT(INOUT). PROTECTED is not a foolproof method of preventing module variables from being changed, as you can probably figure out ways around it, but ordinarily it works well enough. If this isn't good enough, then you have to supply a function that returns the value and make that public in the module, not the variable.

0 Kudos
Steven_L_Intel1
Employee
922 Views

I expect the fix for this to appear in the October update

0 Kudos
Reply