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

problem with compile this code

hamid_mosaddeghi
Beginner
2,559 Views
Hi Dears

I get these errors after compile it with ifort or gfortran:

with ifort

[mosaddeghi@localhost Desktop]$ ifort gfor.f

/opt/intel/Compiler/11.1/064/lib/ia32/for_main.o: In function `main':

/export/users/nbtester/x86linux_nightly/branch-11_1/20091202_010000/libdev/frtl/src/libfor/for_main.c:(.text+0x4d): undefined reference to `MAIN__'
---------------------------------------------------------------------

with gfortran

[mosaddeghi@localhost Desktop]$ gfortran gfor.f
gfor.f:681.50:

dimension aaa(nmax*nmax),bbb(nmax*nmax),bbi(bmax)
1
Error: Expression at (1) must be of INTEGER type, found REAL
gfor.f:681.50:

dimension aaa(nmax*nmax),bbb(nmax*nmax),bbi(bmax)
1
Error: Expression at (1) must be of INTEGER type, found REAL

----------------------------------------------
please help to me for solve it.

Best!

0 Kudos
1 Solution
mecej4
Honored Contributor III
2,559 Views
Intel Fortran, by default, is more tolerant of extensions to the requirements of the standard than other compilers.

If you use the option -stand f95, for example, among other messages you get

[bash]gfor.f(681): warning #6187: Fortran 95 requires an INTEGER data type in this context.
      dimension aaa(nmax*nmax),bbb(nmax*nmax),bbi(bmax)
--------------------------------------------------^[/bash]

View solution in original post

0 Kudos
2 Replies
Kevin_D_Intel
Employee
2,559 Views
The ifort error occurs because there is no main program present in the gfor.f source file. Perhaps the main program appears in another source file in which case you can compile gfor.f with -c option and then join the object file (gfor.o) with another object where main is defined.

The gfortran errors appear related to the implicit real statement at line 676 and thevariable name "bmax"used in line 681. If you rename "bmax" to "ibmax" in lines 680-681 the code compiles with gfortran.

676 implicit real*8(a-h,o-z)
677 c
678 c maximum matrix (mbig*mbig) to invert
679
680 parameter (mbig =100, bmax = mbig*(mbig+1)/2)
681 dimension aaa(nmax*nmax),bbb(nmax*nmax),bbi(bmax)

It appears the specification expression for the array is supposed to be of type integer, so ifort may have missed flagging this like gfortran has. I'll have to lean on those who are more knowledgeable about the Fortran standard to chime in about that.

0 Kudos
mecej4
Honored Contributor III
2,560 Views
Intel Fortran, by default, is more tolerant of extensions to the requirements of the standard than other compilers.

If you use the option -stand f95, for example, among other messages you get

[bash]gfor.f(681): warning #6187: Fortran 95 requires an INTEGER data type in this context.
      dimension aaa(nmax*nmax),bbb(nmax*nmax),bbi(bmax)
--------------------------------------------------^[/bash]
0 Kudos
Reply