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

Porting Fortran Code from ia32 to IA64 - pointer question

Uwe_S_
Beginner
807 Views

In the dll interface of my fortran application I am using the non standard construct pointer (p, pointee). The language reference manual says p will be 32 bit on an ia32 and 64 bit on an Itanium. Is there a way to use this feature in a 64 bit environment such as long pointer (p, pointee)? More precisely: Code:

iaz = loc(b(xmap(2,49)))
    ..............
    Subroutine sub1 ()
    integer*4 iaz
    real*8 ia(1)
    common /dll/iaz
    pointer (pia, ia)
    pia    = iaz
    access to array ia


Is it possible to port this type of code to ia64, by specifying integer*64 and using some tpye of 64 bit pointer in Fortran such as long pointer?

0 Kudos
4 Replies
Jugoslav_Dujic
Valued Contributor II
807 Views
On 64-bit systems, LOC() will return a 64-bit pointer, and in declaration

pointer (pia, ia)

pia will also be 64-bit one. However, iaz in your example is obviously too small, as it's declared as 32-bit.

CVF has (non-standard) INT_PTR_KIND() which returns the Fortran kind number of C pointer (4 on IA32, 8 on IA64). I suggest that you define something like


MODULE MyKinds
INTEGER, PARAMETER:: C_POINTER = INT_PTR_KIND()
END MODULE MyKinds
...
SUBROUTINE Foo
USE MyKinds
INTEGER(C_POINTER):: iaz
END SUBROUTINE


In this way, you define the C_POINTER only once and retain almost all portability.

HTH,
Jugoslav
0 Kudos
Uwe_S_
Beginner
807 Views
thank you very much for your answer.
I presume a xeon processor with Intel 64 Bit Memory technology is a 64 bit system?
0 Kudos
TimP
Honored Contributor III
807 Views
Yes, ifort for em64t also chooses a 64-bit integer for INT_PTR_KIND.
0 Kudos
Steven_L_Intel1
Employee
807 Views
It is not sufficient to identify the processor. The Xeon processors with EM64T can run as either 32-bit or 64-bit processors, depending on which operating system you load. If you are running Windows x64 editions, and use the Intel EM64T compiler, pointers are 64 bits. Otherwise they are 32 bits.
0 Kudos
Reply