Hi,
I'm experiencing difficulties in implementing
64 bit integers (INTEGER*8, KIND=8) types within F90.
The problems occur with the PORTLAND GROUP pgf90
compiler under LINUX, but not with the SGI f90 compiler.
I have found at least two instances of what appears to be
improper compiler behavior.
My question: is this a compiler bug, or is it a F90
implimentational error? If it is a compiler bug, does
anyone have a workaround?
!----------------------------------------------
Here is the first instance:
PROGRAM BreakPGF90
INTEGER(KIND=8) :: I,K,Two
Two=2_8
DO K=0,63
I=Two**K
WRITE(*,*)K,' I = ',I
ENDDO
END PROGRAM
With pgf90, I get 0's after k=31, but with SGI
f90 I'm ok up to K=63.
Under PGF90, I get what appears to be INTEGER*4:
30 I = 1073741824
31 I = -2147483648
32 I = 0
On SGI, I get INTEGER*8:
...
30 I = 1073741824
31 I = 2147483648
32 I = 4294967296
...
62 I = 4611686018427387904
63 I = -9223372036854775808
!----------------------------------------------
Here is the second instance:
PROGRAM BreakPGF90_2
INTEGER, PARAMETER :: INT8=SELECTED_INT_KIND(18) !--Integer*8
INTEGER(INT8) :: I
I=0
I=IBSET(I,8) ! This line breaks pgf90 compiler, is fine on SGI
WRITE(*,1)I
1 FORMAT(' I = ',B64)
END PROGRAM
Under LINUX, pgf90 gives the following internal compiler error:
Lowering Error: unexpected result type for intrinsic function [ast=46,asttype=14,datatype=7]
PGF90-F-0000-Internal compiler error. Errors in Lowering 1 (Tst.f90: 8)
PGF90/any Linux/x86 Rel 1.7-6: compilation aborted
!----------------------------------------------
Also, I was unable to get the NAG f90 compiler to give anything
else than a -1 for SELECTED_INT_KIND(R), with R being near 18.
I'd very much appreciate any workarounds for dealing with these 64 bit
integer problems with either the pgf90 or NAG f90 compilers and/or
comments on my programming.
Thanks, Matt
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Matt Challacombe
Los Alamos National Laboratory http://www.t12.lanl.gov/~mchalla/
Theoretical Division email: [log in to unmask]
Group T-12, Mail Stop B268 phone: (505) 665-5905
Los Alamos, New Mexico 87545 fax: (505) 665-3909
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|