- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Today I've tried to compile my solution with new Intel Visual Fortran Composer 2015.
I get permanent compiler errors for "final" implementation: #5522: FINAL subroutines must be defined with the default calling convention.
Seems to be related to the used calling convention in my solution. Due to compatibility issues I do use the setting "CVF (/iface:cvf)".
It worked fine with Intel Visual Fortran Composer 2013 SP1 Update4.
How can I fix this bug?
Thanks in advance for all comments,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you absolutely need /iface:cvf, you can add:
!DEC$ ATTRIBUTES DEFAULT :: name_of_final_routine
in the routine. If the routine is in a module or CONTAINed, that's all that should be necessary, Anytime there is a "callback" type routine, whether it be a FINAL routine, USEROPEN, IMSL or other, it needs to use the default calling convention. That you didn't get a build error before was a bug that got fixed. Without the error, you would have silent stack corruption.
But as app4619 says, removing the "CVF" calling convention option is the best approach. You do this under Fortran > External Procedures. Change Calling Convention to Default.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What in your project required Iface CVF? There are only some limited cases where this would be needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need the "CVF (/iface:cvf)" option for compatibility to old stuff. Some are Salford projects and some are projects from external companies which require the Compaq Visual Fortran calling convention. So I can't switch it to "DEFAULT". But it should not be necessary to switch it OFF, because it worked well before.
Maybe I've missed a related information in the release notes but I could not find a not an information that support for some calling conventions were dropped.
I don't think that this behaviour is a new feature, therefore my question is: is this a bug in the compiler?
If it is a bug, is there a work-around available?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you absolutely need /iface:cvf, you can add:
!DEC$ ATTRIBUTES DEFAULT :: name_of_final_routine
in the routine. If the routine is in a module or CONTAINed, that's all that should be necessary, Anytime there is a "callback" type routine, whether it be a FINAL routine, USEROPEN, IMSL or other, it needs to use the default calling convention. That you didn't get a build error before was a bug that got fixed. Without the error, you would have silent stack corruption.
But as app4619 says, removing the "CVF" calling convention option is the best approach. You do this under Fortran > External Procedures. Change Calling Convention to Default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can I fix this bug?It is not a bug, it is a missing feature :) . Final subroutines were not present in Fortran 95, and were not present in CVF. In effect, you are asking for a feature that came with F2003, and you want those subroutines to be called using an unsupported/unimplemented calling convention.
Secondly, if you do need to call external library routines using the CVF interface, you can probably achieve that without using the sledgehammer approach of applying /iface:cvf to new code as well as old code. You can collect the names of routines that require the CVF interface, and provide interfaces to them in the calling routines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot for your comments. I'll try it with the default calling convention specification using the !DEC! specification.
@ mecej4: I cannot see how the calling convention is related to the Fortran standard. It defines how arguments are passed and how the stack clean-up is done. The problem is that other external apps call our code so no sledge hammer is used, just a definition of calling conventions (even I don’t like it but not this is not my decision at all to change it).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rather than using the sledgehammer of /iface:cvf, add:
!DEC$ ATTRIBUTES CVF :: routine-name
to each routine that is callable by outside users with CVF conventions. If any of these routines are also called internally, add the same directive to the callers. This will use the default conventions for everything else.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page