- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
--------------------
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.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page