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

why automatic variables can not be compiled on Intel fortran compiler

r_zhang-2
Beginner
582 Views
Hi,
I am using Intel Fortran compiler 32 bit for linux. In the process of running my model on linux, I alwasy encounter this kind of error message:
Syntax error, found END-OF-STATEMENT when expecting one of:
AUTOMATIC ::
That is because one of my subroutine variables are defined as AUTOMATIC.I check the Intel literature and it saysVersion 9.0 support automatic variables. And I also add some argument after command 'ifort', howeverit does not work.
I hope someone can give me some tips on this.
Thanks a lot.
Rui
0 Kudos
6 Replies
Steven_L_Intel1
Employee
582 Views
What is the exact statement you are using and the exact compiler version?

Note that AUTOMATIC is an extension to the language. I seem to recall that in some earlier version, the compiler did not accept AUTOMATIC and STATIC as attributes. You could say:

AUTOMATIC X

but not:

AUTOMATIC :: X

Both should work in current versions.
0 Kudos
r_zhang-2
Beginner
582 Views

Thanks for your quick reply!In my windows version of compaq Fortran compiler, I define the subroutine variables as belows:

INTEGER ITMAX
REAL tol,x1,x2,func,EPS
EXTERNAL func
PARAMETER (ITMAX=30,EPS=3.e-8)
INTEGER iter
REAL a,b,c,d,e,fa,fb,fc,p,q,r,s,tol1,xm
AUTOMATIC

Now i have to use Intel Fortran compiler for Linux to run my model.

My ifort version is:

-bash-3.00$ ifort --version
ifort (IFORT) 9.0 20051201
Copyright ( C) 1985-2005 Intel Corporation. All rights reserved.

And I am using:

ifort -automatic -I/home/s0340767/lib/fnlux04dcl/lib/nag_mod_dir file1.f90 file2.f90 -L/home/s0340767/lib/fnlux04dcl/lib -lnagfl90 -lcrypt -lpthread

to compile.

Thanks in advance.

Rui

0 Kudos
Steven_L_Intel1
Employee
582 Views
Ah, I see.

It was a bug in CVF that the AUTOMATIC statement was allowed without any variables named. We fixed that bug in Intel Fortran. There is no defined meaning for just AUTOMATIC by itself.

If you want all local variables to be automatic, then use -automatic or add the RECURSIVE keyword to the routine declaration.
0 Kudos
r_zhang-2
Beginner
582 Views
Hi, Steve,
Thanks for your reply.
I get rid of -automatic option in the command line, because I only want some of local variables automatic and I add recursive argument to the subroutine.It is compilable but the model come down to dead loop. I am wondering whether the order of the subroutines I call in the ifort command line is significant.
Thanks a lot.
Rui
0 Kudos
Steven_L_Intel1
Employee
582 Views
No, the order is not significant as long as you don't have a dependency on .mod file generation.
0 Kudos
r_zhang-2
Beginner
582 Views

Hi, Steve,

Thanks a lot for your kind help. The model is running ok on unix now.

Rui

0 Kudos
Reply