Can anyone explain why the following program does not work? All but the first element of array lar2 are truncated to the lower 32 bit by sortqq. That's independent of compiler version and the inclusion of a "use ifport" statement.
use ifport
implicit none
integer*4 i,mod,iflag,size
c integer*4 irand
integer*4 iaux
integer*8 lar2(15),count,adrarray
iflag=1374
i=mod(irand(iflag),15)+1
iflag=0
do i=1,15
iaux=mod(irand(iflag),15)+1
lar2(i)=iaux*2_8**32+i
write (*,*) lar2(i)
end do
adrarray=loc(lar2)
count=15
c size=Z'00060000'
size=SRT$INTEGER8
write (*,*) adrarray,count,size
CALL SORTQQ (adrarray,count,size)
write (*,*) adrarray,count,size
write (*,*) 'After sort:'
do i=1,15
write(*,*) lar2(i)
end do
stop
end
> ifort sortqqbug.f
> ./a.out
21474836481
12884901890
38654705667
30064771076
34359738373
47244640262
17179869191
12884901896
12884901897
17179869194
25769803787
25769803788
34359738381
30064771086
25769803791
6925152 15 393216
6925152 15 393216
After sort:
2
5
6
7
8
9
10
11
12
15
21474836481
4
13
14
3