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

allocated flag strange

nakada-h
Beginner
605 Views

I have trouble which allocated flag become T at Linux IA64.
Is this phenomenon compiler's bug?
Please teach me the source of the trouble.
Thank you.

$ uname -a
Linux dec2003 2.4.18-nec3.3.026 #1 SMP Mon Oct 25 21:04:48 JST 2004 ia64 unknown
$ which ifort
/opt/intel_fc_80/bin/ifort
$ ifort -v
Version 8.1
---- a.f90 begin ---------------
program test
implicit none
type tmatrix_t;real(8),pointer::e(:,:);end type
type hmatrix_t;real(8),pointer::e(:,:);end type
type param_t
integer(4),pointer::nkbas(:)
type (tmatrix_t),pointer::t1(:)
type (hmatrix_t),pointer::h1(:)
type (hmatrix_t),pointer::h2(:)
type (tmatrix_t),pointer::t2(:)
end type
type (param_t):: par
real(8)::abs1,abs2
open(unit=80,file='input.inf')
read(80,*) abs1, abs2
close(80)
allocate(par%nkbas(0:3))
allocate(par%t1(0:2))
allocate(par%h2(0:3))
allocate(par%t2(0:2))
allocate(par%h1(0:3))
write(6,*) 'associated(par%h1(0)%e) = ',associated(par%h1(0)%e)
write(6,*) 'associated(par%h1(1)%e) = ',associated(par%h1(1)%e)
write(6,*) 'associated(par%h1(2)%e) = ',associated(par%h1(2)%e)
write(6,*) 'associated(par%h1(3)%e) = ',associated(par%h1(3)%e)
stop
end
---- a.f90 end -----------------
---- input.inf begin -----------
1.d-10 1.d-8
70
3.5000 3.7000 3.9000 4.1000 4.3000 4.5000 4.7000 4.9000 5.1000 5.3000
5.5000 5.7000 5.9000 6.1000 6.3000 6.5000 6.7000 6.9000 7.1000 7.3000
7.5000 7.7000 7.9000 8.1000 8.3000 8.5000 8.7000 8.9000 9.1000 9.3000
9.5000 9.7000 9.9000 10.1000 10.3000 10.5000 10.7000 10.9000 11.1000 11.3000
11.5000 11.7000 11.9000 12.1000 12.3000 12.5000 12.7000 12.9000 13.1000 13.3000

---- input.inf end -----------
$ ifort a.f90
$ ./a.out
associated(par%h1(0)%e) = F
associated(par%h1(1)%e) = F
associated(par%h1(2)%e) = F
associated(par%h1(3)%e) = T <-- strange why not F?
I use only 1 read.
---- input.inf begin -----------
1.d-10 1.d-8
70
3.5000 3.7000 3.9000 4.1000 4.3000 4.5000 4.7000 4.9000 5.1000 5.3000
5.5000 5.7000 5.9000 6.1000 6.3000 6.5000 6.7000 6.9000 7.1000 7.3000
7.5000 7.7000 7.9000 8.1000 8.3000 8.5000 8.7000 8.9000 9.1000 9.3000
9.5000 9.7000 9.9000 10.1000 10.3000 10.5000 10.7000 10.9000 11.1000 11.3000

---- input.inf end -----------
After I remove 7th line in input.inf, result is normal.
$ ./a.out
associated(par%h1(0)%e) = F
associated(par%h1(1)%e) = F
associated(par%h1(2)%e) = F
associated(par%h1(3)%e) = F

0 Kudos
2 Replies
Steven_L_Intel1
Employee
605 Views
The pointers e are undefined at the point of your asking if they are associated. Because of this, the result of the associated function is also undefined (actually, the standard says that you're not allowed to ask if undefined pointers are associated.)

If you add "=>NULL()" to the declarations of the pointer e, then you will get consistent results.
0 Kudos
nakada-h
Beginner
605 Views
Thank you very much for answering my question! Mr.Steve
0 Kudos
Reply