- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following program compiles and runs with Intel Visual Fortran versions 10.1 through 14.0:
PROGRAM TESTTYPE
TYPE MYTYPE
INTEGER :: I => 0
END TYPE MYTYPE
TYPE(MYTYPE) :: X
WRITE(*,*) X%I
END PROGRAM TESTTYPE
However, in versions 15 & 16 it fails with the following message:
testtype.f90(4): error #6680: A constant is not permitted in this context. [0]
INTEGER :: I => 0
----------------------^
compilation aborted for testtype.f90 (code 1)
It is noted that replacing the '=>' operator with '=' in the initialization expression works in all versions of the compiler tested.
------------------------------------------------------------------------------------------------------
QUESTION: What is the reason for the change in behaviour?
------------------------------------------------------------------------------------------------------
The IVF documentation states:
Is an initialization expression, or for pointer components, => NULL( ).
If init-ex is specified, a double colon must appear in the component definition. The equals assignment symbol (=) can only be specified for nonpointer components.
The initialization expression is evaluated in the scoping unit of the type definition.
One reading of the highlighted clause is that '=' or '=>' could be used for non-pointer components but that '=' must not be used for pointer components.
Many thanks,
David.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will research this changed behavior David and let you know what I find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Surely the compiler is just identifying bugs in your code that it did not identify before. The new behavior is an improvement!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For what it is worth, the text in the current standard makes it absolutely clear.
"If => appears in component-initialization, POINTER shall appear in the component-attr-spec list. If = appears in component-initialization, neither POINTER nor ALLOCATABLE shall appear in the component-attr-spec-list."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Development believes parsing was also cleaned up for incorrect uses (as others noted regarding the Fortran Standard) of “=>” for non-pointer initialization in conjunction with this earlier post and internal tracking id DPD200157846 which was fixed in the 15.0 release, so this is the reason for the change in behavior.
I notified our Documentation writers about clarifying the init-ex component description and the statement you cited to make the "=" and "=>" uses clearer in a future revision.
(Internal tracking id: DPD200376067)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for looking into this issue Kevin and thank you Ian H for pointing out relevant text in the standard ... the latter may be of assistance to the Intel documentation writers in their review of the init-ex component description.
Regards,
David.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're welcome David. Yes, I agree. I passed along IanH's earlier citation to the Doc writers. It was helpful and very clear.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Kevin Davis (Intel) wrote:
You're welcome David. Yes, I agree. I passed along IanH's earlier citation to the Doc writers. It was helpful and very clear.
Kevin,
Please see my Message #11 in another thread where documentation is being discussed:
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page