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

porting a Fortran-Program from Windows to Linux

michael_wilch
Beginner
752 Views
I'm trying to compile a program of 
my professor under Linux.
I am using the Intel Fortran Compiler 9.1.033 
with SuSE 10.1 (glibc 2.4-31.1).
Since the program is command-line-based and 
compiles with Visual Fortran without 
any remarks, I thought it would be a simple task.
Unfortunately, I am quite a beginner with Fortran, 
so I am not very experienced with the syntax 
or even debugging.
The project consists of a bunch of files, 
which are referring to some Include-files.
Usually, those Include-files are found by 
the compiler, but sometimes, it is reporting
strange errors. I invoked the compiler by:

ifort -c test.bin -132 -nowarn -isystem /home/michael/files/Includes  *

which should build a "test.bin".
I receive a lot of Warning-statements, 
most of them regarding the data type of variables, like:

fortcom: Warning: /home/michael/files/Includes/linpsd.ins, line 14: Because of COMMON, the alignment of object is inconsistent with its type   [AUSL_UR]
                real*8     ur1_0(maxk),ui1_0(maxk),ausl_ur(maxk),ausl_ui(maxk)  !       Devaraja am 13.3.97
---------------------------------------------------^

or

fortcom: Warning: /home/michael/files/Includes/linpsd.ins, line 9: Because of COMMON, the alignment of object is inconsistent with its type   [FAKTOR_U]
        real*8       faktor,faktor_u
----------------------------^

Under Windows, the Compiler does not display 
any such warnings. Am I missing a necessary 
Compiler-option?

But that's not the main problem, I would have ignored those warnings. It also produces an error like

fortcom: Error: diff0.f, line 10: Syntax error, found HEX_OCT_BIN_CONSTANT ''KANAL.INS'O' when expecting one of:   
      include 'kanal.ins'o
--------------^
fortcom: Error: diff0.f, line 20: Syntax error, found '.' when expecting one of: => = / ( * ,  ; [
     *. defined (version_fgh)
--------^
compilation aborted for diff0.f (code 1)

The start of the 'diffo.f'-file is as follows:

subroutine diff0 (error)
*
* D-Glied mit Verzoegerung
* Aufbau des Zeigers zeig und Belegung des Reglervektors vek
*
include 'parreg.ins'
include 'reg0.ins'
include 'reg1.ins'
include 'reg2.ins'
include 'kanal.ins'
$if .not. defined (version_fgh)
include 'prgctrl.ins'
character*6 blname
$endif
real*8 anfw,t1,td !BGi. 27.03.1998 1998/11/20 real*8 gr1,gr2
integer error
***
*
$if .not. defined (version_fgh)
if (lin_an.and..not.Statblock) then
read(zeile(3:8),111) blname
111 format(a6)
write(77) blname,'diff ',kk+4
end if ! lin_an
$endif 

What is going wrong here and how can I fix it?
As I said, VisualFortran does not see any problem.

Thanks a lot,

Michael

 

0 Kudos
1 Reply
Steven_L_Intel1
Employee
752 Views
I don't know which "Visual Fortran" you used, but the source as shown would not be accepted by any of the Visual Fortran products I know (DEC, Compaq, Intel). The problem is the $IF and $ENDIF lines. These may be accepted by some other compiler, but not Visual Fortran. Use:this instead:

!DEC$ if defined (version_fgh)
!DEC$ else
if (lin_an.and..not.Statblock) then
read(zeile(3:8),111) blname
111 format(a6)
write(77) blname,'diff ',kk+4
end if ! lin_an
!DEC$ endif
Using this syntax, a "not defined" directive is not available. An alternative is this:

#ifndef version_fgh
if (lin_an.and..not.Statblock) then
read(zeile(3:8),111) blname
111 format(a6)
write(77) blname,'diff ',kk+4
end if ! lin_an
#endif


when compiled with -fpp (or you name your source with a F90 (capital F) file type.

It's possible that if you clean this up, the other warning will go away. I'm puzzled that you get the common alignment warning even with -nowarn.
0 Kudos
Reply