Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

ifort 9 compiles, ifort 11 not

messalacorvino
Beginner
290 Views
module_test.f90:
--------------------
module mod_test
implicit none
contains

real function add_sum (a,b,c)
real,intent(in) :: a,b,c
real :: nothi

add_sum = a + b + nothi(c)

end function add_sum

real function nothi (d)
real,intent(in) :: d

nothi = d

end function nothi

end module mod_test

main_test.f90:
-----------------
program test
use mod_test
implicit none

real :: a,b,c,res

a=1.
b=1.
c=1.

res = add_sum ( a, b, c )
write(*,*)res

end program test

********************************************
"ifort module_test.f90 main_test.f90" gives me:

/tmp/ifortvZIo3p.o: In function `mod_test_mp_add_sum_':
module_test.f90:(.text+0x21): undefined reference to `nothi_'

But if i compile with ifort version 9 produces an executable a.out.
0 Kudos
3 Replies
Steven_L_Intel1
Employee
290 Views
And ifort 11 is correct to not compile it. See Doctor Fortran in "Too Much of a Good Thing?" - in particular, the "Up Periscope" section.
0 Kudos
TimP
Honored Contributor III
290 Views
It's frustrating, for sure. I can't find the previous discussion on how 11.x compiler corrected an erroneous treatment of such cases. The corrected interpretation of your source code is that the declaration real :: nothi has the effect of external, as clarified in the f2003 standard. Your code gives nothi() the same visibility in add_sum() which it would have if it were internal to add_sum(). Comment out the real :: nothi to get the effect you apparently intended. Look it up in the draft standard attached to the forum.

0 Kudos
messalacorvino
Beginner
290 Views
thank you.
0 Kudos
Reply