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

ifort and -I option problem

guermouche
Beginner
726 Views
Hello !
I've found a problem with the ifort compiler (with either 9.* version and 10.*). The problem is related to the INCLUDE fortran directive. Let me give first a toy example illustrating the problem :

file toto.F :

PROGRAM TOTO
IMPLICIT NONE
INCLUDE 'toto.h'
A=1
END

file toto.h :

INTEGER A

The compilation works fine with the following command line (we are in the right directory) : ifort -I. toto.F

The problem happens when I create a file named toto.h in the /tmp of the machine. The compiler seems to use this file instead of the one in the current directory. I've checked with a strace on ifortbin and indeed in opens this file (/tmp/toto.h). This behavior seems dangerous! Indeed, if a user copies a .h file in the /tmp, each user including this file may have a problem.

Is it the normal behavior of the compiler? or is it a small feature that should be added?
thanks in advance !
Abdou




0 Kudos
1 Reply
Kevin_D_Intel
Employee
726 Views

I am unable to reproduce this with either the IA-32 or Intel 64 Linux 10.1.017 Fortran compiler. I see no evidence of ifort opening the copy of the include file residing in /tmp. The compiler uses /tmp for scratch files which is evident via strace.

Are you running on Linux or Mac OS?

Can you please capture and post the specific ifort compilation using the -V option with a copy of the include file residing in /tmp?

Also, please capture the strace output into a file that shows the open of /tmp/toto.h and attach the file to this post.

Another test you could conduct is to modify the copy of the include in /tmp so it only declares the variable B instead of A, then add an assignment of B=1 into toto.F, and then compile only with ifort -V -I. toto.F to see what syntax errors are produced.

If the copy of the include file in /tmp is not used, then you will receive and error like:

fortcom: Error: foo.f, line 5: This name does not have a type, and must have an explicit type.

B=1

------^

If the copy of the include file in /tmp is used, then you will receive and error like:

fortcom: Error: foo.f, line 4: This name does not have a type, and must have an explicit type.

A=1

------^

0 Kudos
Reply