- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
we had a rather awkward problem with a routine that we called IIDIM. This is the same name as one
of the specific routines/functions forthe DIMintrinsic function. It turned out that the intrinsic function was
called, not our function - completely according to the Fortran standard of course.
My question is: is there a compiler option in Intel Fortran that flags routine names identical to the names
of intrinsic procedures? I could not find any in the help information.
Another thing: does the set of intrinsic procedures depend on the use of modules like IFPORT? From the
documentation I do get that impression, but I would like to make sure.
Regards.
Arjen
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you have (and use) and explicit interface to your routine? If not, try adding one.
Note, IDEM works as a generic function for integer(1), integer(2), integer(4) and integer(8) so
if your IIDEM takes two integer arguments .and. you are relying on the compiler for promotion/demotion then there may be some ambiguity which results in the incorrect (non-intended) function being called. In this situation you may need to make a generic interface to your IIDEM using permutations of acceptible argument types.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this problem turned up more or less out of the blue, as our function has beenaround
for a long while (at least as far as I know). The followingcode gives two warnings with gfortran -Wall,
but ifort -warn:all does not complain:
! intrinsic.f90 --
! Define a function with the same name as an intrinsic
! Any messages?
!
real function sin( x )
real :: x
sin = x + 1.0
end function sin
real function dim( x, y )
real :: x, y
dim = x + y
end function dim
I actually do see the generated interfaces appear. Hm, I should check whether
my version is indeed used in this case.
Regards,
Arjen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
program test_intrinsic
real :: x, y,z
x = 1.0
y= 2.0
z = sin(x)
write(*,*) 'Sin(x) =', z
z = dim(x,y)
write(*,*) 'Dim(x,y) =', z
end program test_intrinsic
I get the values as computed by the intrinsic functions, notbythe above ones:
Sin(x) = 0.8414710
Dim(x,y) = 0.0000000E+00
I do get the generated modules:
!COMPILER-GENERATED INTERFACE MODULE: Fri May 13 14:30:45 2011
MODULE SIN__genmod
INTERFACE
FUNCTION SIN(X) RESULT(SIN_0)
REAL(KIND=4) :: X
REAL(KIND=4) :: SIN_0
END FUNCTION SIN
END INTERFACE
END MODULE SIN__genmod
If I put the two functions in a module, and use that module, then:
Sin(x) = 2.000000
Dim(x,y) = 3.000000
so in that case my versions are indeed called.
Regards,
Arjen
- 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
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve, Jim,
I understand the issues - this occurred in a large program that is slowly being converted in Fortran 90.
I keep promoting modules as a means to avoid this and other nastiness, but it takes a lot of time to
get there.
Thanks for the replies.
Regards,
Arjen

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