- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I recently updated to Intel Visual Fortran Composer XE 2011 and am running update 3 (w_fcompxe_2011.3.175). With the new compliler I started encountering Error 7977 when using functions that returned values of a user-defined type. The function in question, along with the related data type definition, were defined in a separate module which was accessed by way of the USE command in the main program.
Below is a sample code I was able to create the has the same problem I was encounting in my actual code. The sample consists of a main module with the program and a primary subroutine, a module with the type definition and the function which returns an answer of this type, and a secondary external sub-program.
[bash] program main c implicit none real :: a,b,c,d c a= 10. b= 2. call test(a,b,c,d) c end program main c subroutine test(a,b,c,d) use props implicit none c real :: a,b,c,d type (test_type) :: e c call test_one() c e= f_test(a,b) c= e%x d= e%y write(6,*)e%x,e%y c return end subroutine test[/bash]
[bash] module props c implicit none public c type :: test_type real :: x real :: y end type test_type c contains c function f_test(a,b) result(c) c implicit none c real, intent(in) :: a real, intent(in) :: b type (test_type) :: c c c%x= a**2 c%y= a/(abs(b)+1.) c end function f_test c end module props[/bash]
[bash] subroutine test_one() implicit none real a,b,c a= 2.5 b= 3.5 c= a+b return end subroutine test_one[/bash]
The actual error given when the above is compiled is:
error #7977: The type of the function reference does not match the type of the function definition. [F_TEST]
Of interest, if the call to subroutine test_one is removed from subroutine test, no error is generated. The files above were compiled after doing a full clean of any lingering files from previous builds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does setting the project property Fortran > Diagnostics > Check Routine Interfaces to "No" make the error go away?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve
Are you still there?
I think i have the same Problem with: Microsoft Visual Web Developer 2010 and Intel(R) Visual Fortran Composer XE 2013 SP1 Update 3 Integration for Microsoft Visual Studio* 2010, 14.0.0092.2010
P:\FORTRAN\LIB\ENGELN\KAP04\CYCTR.FOR(153): error #7977: The type of the function reference does not match the type of the function definition. [MACHPD]
I think the program was working fine but not anymore after the update.
How can I solve it?
Thank you for your efforts,
Reto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please display the source code of CYCTR.f90 or at least the lines where the function MACHPD is declared and where it is referenced in an expression.
If your program relies on implicit typing at the point where MACHPD is referenced, MACHPD() would be an integer function. If the compiler had earlier seen a definition for the function with a different type, it would give an error message. More recent versions of IFort do more thorough type consistency checks on code than earlier versions did. Even if your code used to work correctly, it would be wise to locate and remove the inconsistency now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well one immediate thing I noticed is in CYCTRP where you have
DOUBLE PRECISION ... MACHPD
but MACHPD is declared as INTEGER in the function.
Also. What is this next snippet trying to do?
FMACHP = 1.0D0 10 FMACHP = 0.5D0 * FMACHP IF (MACHPD(1.0D0+FMACHP) .EQ. 1) GOTO 10
FMACHP goes from 1.0 to 0.5 to 0.25 to 0.125 to 0.0625 ... because 1.0 + FMACHP is always greater than 1.0 in function MACHPD
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is one of those routines from before the Fortran 90 standard that try to find out the properties of floating-point arithmetic.
There was another thread not long ago, where this was discussed at some length, as the optimiser in Intel Fortran was "too" smart and optimised a crucial element away. However, the routine can easily be reimplemented using one of the numerical inquiry routines.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page