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

ifort, compilation

roddur
Beginner
618 Views

i have seen many program either shows a runtime error/segmentation fault when compiled with gfortran/SUN(on linux platform) but runs smoothly in fortran, as the shown here just for example:

$ gfortran Map.f
In file Map.f:44

nnA(i,ni)=N**4
1
Error: Arithmetic overflow at (1)
In file Map.f:52

nnA(i,ni)=N**4
1
Error: Arithmetic overflow at (1)
In file Map.f:56

if(nnA(i,ni).eq.N**4)then
1
Error: Arithmetic overflow at (1)
In file Map.f:63

else
1
Error: Unexpected ELSE statement at (1)
In file Map.f:64

endif
1
Error: Expecting END DO statement at (1)
In file Map.f:50

goto 20
1
In file Map.f:65

p
2
Warning: Obsolete: GOTO at (1) jumps to END of construct at (2)
[Rudra@snbpc04 BCC]$ ifort Map.f
[Rudra@snbpc04 BCC]$ ./a.out
1 1 1 16
2 2 16 94
3 17 94 514
4 95 514 2756
5 515 2756 14292

What i understood(which is very little about what goes on under the hood) is that the compiler is either not meeting the fortran std. or not using the diskspace properly(as arithmatic overflow of this case). And i was told by one of my friend that one of my code, which i tested with ifort, gfortran and sunf95, fails with xlf. So if i want to make sure that my code is portable to any compiler, what is the way out?

0 Kudos
1 Reply
Steven_L_Intel1
Employee
618 Views

If you'd attach the source we could comment more constructively.

I'll note that Intel Fortran does not do integer overflow checking, whereas gfortran seems to offer this.

0 Kudos
Reply