- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a series of Fortran codes written in Solaris and I am trying to compile them in Ubuntu linux using both the 10.2 and 11 version of the Intel fortran compiler.
It goes well till it reaches this subroutine:
subroutine IS_BAD
$(VALUE,YES)
save
real*8 VALUE
integer K, id_isinf, id_isnan
logical YES
external id_isnan, id_isinf
K = id_isnan (VALUE)
if(K.eq.0) then
K = id_isinf (VALUE)
end if
YES = K.eq.1
return
end
Where the compiler fails with the error message:
/tmp/ifortsXoLgG.o: In function `is_bad_':
aaa.f:(.text+0x7): undefined reference to `id_isnan_'
aaa.f:(.text+0x12): undefined reference to `id_isinf_'
As I know id_isnan and id_isinf is not usable in Linux, so I tried to use isnan() and/or ieee_is_nan() functions instead, but every time it give me the same error message. I read that ieee_is_nan() is included in 11 version, but I am not really good at Fortran unfortunatelly, so I may be doing something very wrong. Could someone please point me into the good direction?:)
Thanks.
I have a series of Fortran codes written in Solaris and I am trying to compile them in Ubuntu linux using both the 10.2 and 11 version of the Intel fortran compiler.
It goes well till it reaches this subroutine:
subroutine IS_BAD
$(VALUE,YES)
save
real*8 VALUE
integer K, id_isinf, id_isnan
logical YES
external id_isnan, id_isinf
K = id_isnan (VALUE)
if(K.eq.0) then
K = id_isinf (VALUE)
end if
YES = K.eq.1
return
end
Where the compiler fails with the error message:
/tmp/ifortsXoLgG.o: In function `is_bad_':
aaa.f:(.text+0x7): undefined reference to `id_isnan_'
aaa.f:(.text+0x12): undefined reference to `id_isinf_'
As I know id_isnan and id_isinf is not usable in Linux, so I tried to use isnan() and/or ieee_is_nan() functions instead, but every time it give me the same error message. I read that ieee_is_nan() is included in 11 version, but I am not really good at Fortran unfortunatelly, so I may be doing something very wrong. Could someone please point me into the good direction?:)
Thanks.
Link Copied
10 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you kept the external and substituted the names of the intrinsics, you would be telling the compiler that you intend to supply your own version of those functions. The Fortran standard intrinsic version of ieee_is_nan is defined (in ifort 11.0) by USE ieee_arithmetic
Likewise, the old Intel ISNAN would be defined by USE ifport.
Ifort 11.0 documentation seems not to have caught up with ieee_arithmetic, so you would have to rely on other references, such as MR&C "Fortran 2003 explained'
Likewise, the old Intel ISNAN would be defined by USE ifport.
Ifort 11.0 documentation seems not to have caught up with ieee_arithmetic, so you would have to rely on other references, such as MR&C "Fortran 2003 explained'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the help. I tried to define ieee_is_nan() using USE ieee_arithmetic. Here is my updated code:
subroutine IS_BAD
$(VALUE,YES)
USE INTRINSIC IEEE_ARITHMETIC
real*8 VALUE
integer K
logical YES
K = ( IEEE_IS_NAN( VALUE ) )
if(K.eq.0) then
K = ( IEEE_IS_INF( VALUE ) )
end if
YES = K.eq.1
return
end
But when I compile it I get the same old error message:
is_bad.f:(.text+0x7): undefined reference to `ieee_is_nan_'
is_bad.f:(.text+0x12): undefined reference to `ieee_is_inf_'
Did I do something wrong?
subroutine IS_BAD
$(VALUE,YES)
USE INTRINSIC IEEE_ARITHMETIC
real*8 VALUE
integer K
logical YES
K = ( IEEE_IS_NAN( VALUE ) )
if(K.eq.0) then
K = ( IEEE_IS_INF( VALUE ) )
end if
YES = K.eq.1
return
end
But when I compile it I get the same old error message:
is_bad.f:(.text+0x7): undefined reference to `ieee_is_nan_'
is_bad.f:(.text+0x12): undefined reference to `ieee_is_inf_'
Did I do something wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See Steve's reply about the syntax of your USE. The compiler should have given you better diagnostics, in my opinion. Then, don't be surprised if the compiler reports a conflict between the logical values returned by the intrinsic functions and the integer type you have given K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm astonished this compiled at all. The correct syntax would be:
USE, INTRINSIC :: IEEE_ARITHMETIC
What switches are you compiling with, and what command are you using to do the link?
USE, INTRINSIC :: IEEE_ARITHMETIC
What switches are you compiling with, and what command are you using to do the link?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm astonished this compiled at all. The correct syntax would be:
USE, INTRINSIC :: IEEE_ARITHMETIC
What switches are you compiling with, and what command are you using to do the link?
USE, INTRINSIC :: IEEE_ARITHMETIC
What switches are you compiling with, and what command are you using to do the link?
I replaced this line using the correct syntax, but then new error messages came, and it aborted. This is what I got (the whole messages):
/home/meszi/program
/home/meszi/program/SYS
is_bad.f(13): error #5082: Syntax error, found '::' when expecting one of: ,
USE, INTRINSIC :: IEEE_ARITHMETIC
--------------------^
compilation aborted for is_bad.f (code 1)
/home/meszi/program/ZOO
/home/meszi/program/PAN
/home/meszi/program/MAIN
/home/meszi/program/SYS/syslib.a(is_bad.o): In function `is_bad_':
is_bad.f:(.text+0x7): undefined reference to `ieee_is_nan_'
is_bad.f:(.text+0x12): undefined reference to `ieee_is_inf_'
Using the old syntax, the first error message disappears and just the last, the usual one remains.
This program has about 4000 different fortran files in several directories. All of them compiles well except the program I inserted earlier. This is the script I am using to compile and link everything together:
cd /home/meszi/program/SYS/
pwd
/opt/intel/Compiler/11.0/074/bin/ia32/ifort -c *.f
ar r syslib.a *.o
rm -f *.o
cd /home/meszi/program/ZOO
pwd
/opt/intel/Compiler/11.0/074/bin/ia32/ifort -c *.f
ar r zoolib.a *.o
rm -f *.o
cd /home/meszi/program/PAN
pwd
/opt/intel/Compiler/11.0/074/bin/ia32/ifort -c [a-k]*.f
ar r panlib.a *.o
rm -f *.o
/opt/intel/Compiler/11.0/074/bin/ia32/ifort -c [l-z]*.f
ar r panlib.a *.o
rm -f *.o
cd /home/meszi/program/MAIN
pwd
ar x /home/meszi/program/PAN/panlib.a program.o box.o
/opt/intel/Compiler/11.0/074/bin/ia32/ifort -o program.pro program.o box.o /home/meszi/program/PAN/panlib.a /home/meszi/program/ZOO/zoolib.a /home/meszi/program/SYS/syslib.a
rm -f program.o box.o
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since this is a .f file, make sure the statement starts in column 7.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
Since this is a .f file, make sure the statement starts in column 7.
It starts in column 6 for me, where I got the error message:
is_bad.f(12): error #5082: Syntax error, found '::' when expecting one of: ,
USE, INTRINSIC :: IEEE_ARITHMETIC
--------------------^
compilation aborted for is_bad.f (code 1)
Now if I start it in column 7, I get this:
is_bad.f(12): error #6278: This USE statement is not positioned correctly within the scoping unit.
USE, INTRINSIC :: IEEE_ARITHMETIC
------^
compilation aborted for is_bad.f (code 1)
For column 5:
is_bad.f(12): error #5149: Illegal character in statement label field
USE, INTRINSIC :: IEEE_ARITHMETIC
----^
is_bad.f(12): error #5082: Syntax error, found '::' when expecting one of: ,
USE, INTRINSIC :: IEEE_ARITHMETIC
-------------------^
compilation aborted for is_bad.f (code 1)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The compiler says you don't have the statement order correct, as if your USE follows some declarations. At least now you've got the compiler seeing it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tethys_meszi
It starts in column 6 for me, where I got the error message:
is_bad.f(12): error #5082: Syntax error, found '::' when expecting one of: ,
USE, INTRINSIC :: IEEE_ARITHMETIC
--------------------^
compilation aborted for is_bad.f (code 1)
As noted, the USE statement must come before all other declarations except for IMPLICIT.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I put the statement before any declarations. After that I realized that I made a mistake and put a $ sign in column 6, start the USE at column 7. When I deleted the $ sign and use a space, then I could compile the program. These 2 mistakes gave the syntax error messages.
So my problem is fixed now.
Thank you very much for the help!
So my problem is fixed now.
Thank you very much for the help!

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