OK, my bad, apologies all :) Size returns a default integer unless
you specify the kind type. With this change to my test code the
Intel compiler works just fine but g95 complains at compile time.
cognac:~/tmp > ifort test.f90
cognac:~/tmp > ./a.out
i= 2147483647
size a= 2147483647
size b= 2147483647 1
i= 4294967294
size a= 4294967294
size b= 2147483647 2
i= 17179869176
size a= 17179869176
size b= 2147483647 8
Stu.
On 31/12/2005, at 12:17, Stuart Midgley wrote:
> Extra to my previous email, I used a slightly modified test code
> which produces interesting results. These indicate that the intel
> compilers use a standard 32bit int for the size of each dimensions
> in the array.
>
> program test
> integer(8) :: i
> integer(4) :: j
> real(8), dimension(:), allocatable :: a
> real(8), dimension(:, :), allocatable :: b
>
> i = huge(j)
> write(*,*) 'i= ', i
> allocate(a(i), b(huge(j), 1))
> write(*,*) 'size a= ', size(a)
> write(*,*) 'size b= ', size(b,1), size(b,2)
> deallocate(a,b)
>
> i = huge(j)*2_8
> write(*,*) 'i= ', i
> allocate(a(i), b(huge(j),2))
> write(*,*) 'size a= ', size(a)
> write(*,*) 'size b= ', size(b,1), size(b,2)
> deallocate(a,b)
>
> i = huge(j)*8_8
> write(*,*) 'i= ', i
> allocate(a(i),b(huge(j),8))
> write(*,*) 'size a= ', size(a)
> write(*,*) 'size b= ', size(b,1), size(b,2)
> deallocate(a,b)
> end program test
>
>
>
> Compiling with intel
>
> cognac:~/tmp > ifort test.f90
> cognac:~/tmp > ./a.out
> i= 2147483647
> size a= 2147483647
> size b= 2147483647 1
> i= 4294967294
> size a= -2
> size b= 2147483647 2
> i= 17179869176
> size a= -8
> size b= 2147483647 8
>
>
>
> Compiling with g95-ia64-32
>
> cognac:~/tmp > g95 test.f90
> cognac:~/tmp > ./a.out
> i= 2147483647
> size a= 2147483647
> size b= 2147483647 1
> i= 4294967294
> size a= 0
> size b= 2147483647 2
> i= 17179869176
> At line 23 of file test.f90
> Traceback: not available, compile with -ftrace=frame or -ftrace=full
> Operating system error: Cannot allocate memory
> Memory allocation failed
>
>
>
> Compiling with g95-ia64-64
>
> cognac:~/tmp > g95 test.f90
> cognac:~/tmp > ./a.out
> i= 2147483647
> size a= 2147483647
> size b= 2147483647 1
> i= 4294967294
> size a= 4294967294
> size b= 2147483647 2
> i= 17179869176
> size a= 17179869176
> size b= 2147483647 8
>
>
>
> --
> Dr Stuart Midgley
> [log in to unmask]
>
>
--
Dr Stuart Midgley
[log in to unmask]
|