Hello
I have finally decided to move from f77 to f90 free format, so I "translate" one of my programs to f90 format. Before doing it, ifort doesn't have any problem to compile lines that use dreal and dimag, but now, ifort complains
ifort -nbs -g -debug all -c Bispec.f90
fortcom: Warning: Bispec.f90, line 1282: This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL. [DREAL]
sp (jk) = sp (jk) + dreal (f (k) / cs2 * f (lb - k) )
---------------------------------------^
fortcom: Warning: Bispec.f90, line 1298: This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL. [DIMAG]
bi (nb) = bi (nb) + dimag (f (il) / cs3 * f (il) * f (lb - 2 * il) )
----------------------------------------------------^
ifort -Vaxlib -o Bispec f2kcli.o numread.o rnumread.o charead.o readhead.o cdchi.o cdg.o number.o sort.o head.o far.o dcholdc.o dcholsl.o dinverse.o dfft.o outar.o taper.o p2chi.o zroots.o port.o stats.o Bispec.o -lmatio -lz
/usr/lib/libmatio.a(mat.o)(.text+0x333): In function `Mat_VarDelete':
/home/eduardo/Hinich_2006/matio/src/mat.c:476: warning: the use of `mktemp' is dangerous, better use `mkstemp'
Bispec.o(.text+0xb1ce): In function `p23':
/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1282: undefined reference to `dreal_'
Bispec.o(.text+0xb3f8):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1297: undefined reference to `dreal_'
Bispec.o(.text+0xb58f):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1298: undefined reference to `dimag_'
Bispec.o(.text+0xb7d7):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1314: undefined reference to `dreal_'
Bispec.o(.text+0xb95e):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1316: undefined reference to `dimag_'
Bispec.o(.text+0xbb8f):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1330: undefined reference to `dreal_'
Bispec.o(.text+0xbd1c):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1332: undefined reference to `dimag_'
Bispec.o(.text+0xbf3d):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1346: undefined reference to `dreal_'
Bispec.o(.text+0xc0c8):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1348: undefined reference to `dimag_'
make: *** [Bispec] Error 1
What is going on?
Many thanks
Ed
I have finally decided to move from f77 to f90 free format, so I "translate" one of my programs to f90 format. Before doing it, ifort doesn't have any problem to compile lines that use dreal and dimag, but now, ifort complains
ifort -nbs -g -debug all -c Bispec.f90
fortcom: Warning: Bispec.f90, line 1282: This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL. [DREAL]
sp (jk) = sp (jk) + dreal (f (k) / cs2 * f (lb - k) )
---------------------------------------^
fortcom: Warning: Bispec.f90, line 1298: This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL. [DIMAG]
bi (nb) = bi (nb) + dimag (f (il) / cs3 * f (il) * f (lb - 2 * il) )
----------------------------------------------------^
ifort -Vaxlib -o Bispec f2kcli.o numread.o rnumread.o charead.o readhead.o cdchi.o cdg.o number.o sort.o head.o far.o dcholdc.o dcholsl.o dinverse.o dfft.o outar.o taper.o p2chi.o zroots.o port.o stats.o Bispec.o -lmatio -lz
/usr/lib/libmatio.a(mat.o)(.text+0x333): In function `Mat_VarDelete':
/home/eduardo/Hinich_2006/matio/src/mat.c:476: warning: the use of `mktemp' is dangerous, better use `mkstemp'
Bispec.o(.text+0xb1ce): In function `p23':
/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1282: undefined reference to `dreal_'
Bispec.o(.text+0xb3f8):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1297: undefined reference to `dreal_'
Bispec.o(.text+0xb58f):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1298: undefined reference to `dimag_'
Bispec.o(.text+0xb7d7):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1314: undefined reference to `dreal_'
Bispec.o(.text+0xb95e):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1316: undefined reference to `dimag_'
Bispec.o(.text+0xbb8f):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1330: undefined reference to `dreal_'
Bispec.o(.text+0xbd1c):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1332: undefined reference to `dimag_'
Bispec.o(.text+0xbf3d):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1346: undefined reference to `dreal_'
Bispec.o(.text+0xc0c8):/home/eduardo/Hinich_2006/bispec_f90/Bispec.f90:1348: undefined reference to `dimag_'
make: *** [Bispec] Error 1
What is going on?
Many thanks
Ed
链接已复制
7 回复数
Does ifort recognize this extension when the -vms flag is used? I don't see how it could be a free vs fixed format issue. The compiler should treat non-standard extensions the same in either format. I couldn't think of a simple example to illustrate your point; do you have one? Since f90, compilers are supposed to have a means for diagnosing non-standard code, but I couldn't find a way to have it rejected.
DREAL and DIMAG are still there. But you seem to have introduced a problem somewhere else so that the arguments to these routines aren't a COMPLEX type anymore. Perhaps you omitted a declaration or misspelled something?
I have used the same Makefile structure to compile Bispec.for and Bispec.f90. In one Makefile I use extention .for and in the other one .f90. I haven't changed flags or anything else.
ifort with .for - No warnings - nothing.
ifort with .f90 - Warnings and link error shown in the previous post.
The variables involved in the problem were declared as
complex (16) :: f (0:lb - 1), cs2, cs3
I don know whay ifort rejects dreal. Ok. I have changed dreal and dimag to qreal and qinag and everything worked as far as linking compiling are concerned. Running Bispec.for and Bispec.f90 is anotehr matter, that is, different results!
Ed
ifort with .for - No warnings - nothing.
ifort with .f90 - Warnings and link error shown in the previous post.
The variables involved in the problem were declared as
complex (16) :: f (0:lb - 1), cs2, cs3
I don know whay ifort rejects dreal. Ok. I have changed dreal and dimag to qreal and qinag and everything worked as far as linking compiling are concerned. Running Bispec.for and Bispec.f90 is anotehr matter, that is, different results!
Ed
Look in /opt/intel/fc/9.0/docs for the language reference manual (lang_for.pdf) The table for type declaration says:
COMPLEX
COMPLEX(4) (or COMPLEX*8)
DOUBLE COMPLEX (COMPLEX(8) or COMPLEX*16)
COMPLEX(16) (or COMPLEX*32)
With the non-standard * notation, the number is the total length in bytes of the variable. For the Fortran 90 KIND notation, the number is the KIND, and for COMPLEX, it is the kind of each real part.
Let me also suggest, while you are making changes, that you use the generic REAL and AIMAG rather than the specific DREAL and DIMAG.
COMPLEX
COMPLEX(4) (or COMPLEX*8)
DOUBLE COMPLEX (COMPLEX(8) or COMPLEX*16)
COMPLEX(16) (or COMPLEX*32)
With the non-standard * notation, the number is the total length in bytes of the variable. For the Fortran 90 KIND notation, the number is the KIND, and for COMPLEX, it is the kind of each real part.
Let me also suggest, while you are making changes, that you use the generic REAL and AIMAG rather than the specific DREAL and DIMAG.
