- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am running into a problem that appears to relate to ambiguous generic procedure references and defined assignment. For a functional example, please see the attached file.
To summarize, we have a generic assignment procedure defined to take two dummy arguments (e.g. lhs and rhs) declared as "class(A)", but it is not being called when code assigns a variable of "type(B)" that extends "type(A)".
With Intel Fortran 2015, the generic assignment IS called and our code works, but with later versions, the generic assignment is NOT called.
The relevant parts of the Intel documentation state that dummy arguments are distinguishable if "
Clearly, later versions of the compiler are deciding to use intrinsic assignment of the extended derived type rather than the user-declared form that takes "class(A)" arguments. This creates significant problems for us because the base class manages reference counting, and with the newer compiler our reference counting is broken.
For those that don't use the older compiler, the output from compiling the attached file with 2015 is
Assigning 1 to 0 Closing 0 Closing 1 Assigning 2 to 1 Closing 1 Closing 2 Assigning 3 to 2 Closing 2 Closing 3 Assigning 4 to 3 Closing 3 Closing 4 Assigning 5 to 4 Closing 4 Closing 5 Closing 42 Closing 5
With the newer compilers, the "Assigning..." lines are missing. Without them, our reference counts are not incremented (in the full code) and the finalization causes reference counts prematurely go to zero and release resources too soon.
Thoughts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Thomas F.,
my first thought is that the generic interface (as opposed to the specific subroutine) is declared private in the module in your attached program and therefore not accessible from the program, it is possible older compilers did not strictly enforce this.
Suggestion: state "public :: assignment(=)" in the module declaration part.
(https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-public)
Kind regards
Ferdinand
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Thomas F.,
my first thought is that the generic interface (as opposed to the specific subroutine) is declared private in the module in your attached program and therefore not accessible from the program, it is possible older compilers did not strictly enforce this.
Suggestion: state "public :: assignment(=)" in the module declaration part.
(https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-public)
Kind regards
Ferdinand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes! This fixed the issue. Apparently in 2015 generic interfaces were (incorrectly) public by default.
Thank you!
Ferdinand T. wrote:Dear Thomas F.,
my first thought is that the generic interface (as opposed to the specific subroutine) is declared private in the module in your attached program and therefore not accessible from the program, it is possible older compilers did not strictly enforce this.
Suggestion: state "public :: assignment(=)" in the module declaration part.
(https://software.intel.com/en-us/fortran-compiler-developer-guide-and-re...)
Kind regards
Ferdinand
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page