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

Migrate from Lahey Fortran compiler

Zhiwen
Beginner
682 Views
Hello, I am trying to compile a big Fortran program (about 1000 subroutines)that used to be compiled with Lahey under Windows. The code uses Lahey extension of OFFSET() function, which according to Lahey manual:

OFFSET() - Get the DOS offset portion of the memory address of a variable, substring, array reference, or external subprogram.

The particular function is actually very simple:

FUNCTION MEML(ARRAY)

DIMENSION ARRAY(1)

MEML=OFFSET(ARRAY)

RETURN

END

Originally, I used LOC to replace OFFSET function in the above function. HOwever, that results in memory access violation error when running the program. Can somebody give me a hint as to how to convert this particular Lahey fortran extension?

0 Kudos
2 Replies
mecej4
Honored Contributor III
682 Views
When a nonstandard function such as OFFSET or LOC is seen in a program, it may be suspected that the result returned by such a function is also used in a nonstandard way. Therefore, merely replacing one nonstandard function by another, while allowing the program to be compiled and linked, may not give one a correctly functioning program.

Therefore, it becomes necessary to ask what is done with MEML. The misty reference to DOS offset suggests that OFFSET may return a 16-bit integer, whereas LOC may return a 32 or 64 bit integer.
0 Kudos
Zhiwen
Beginner
682 Views
Thanks for the help. I will look further into the code.
0 Kudos
Reply