"James Giles" <jamesgiles@[EMAIL PROTECTED]
> wrote in message
news:_2rVj.186212$D_3.46099@[EMAIL PROTECTED]
> Some people might read the above as implying that there's an
> incompatibility between F95 and F2003. That's not quite right. The
> syntax and semantics of those cases allowed by the old standard
> are identical in the new standard. However, the new standard
> provides a meaning for cases the older standard explicitly prohibited.
> No standard conforming F95 program should behave any differently
> under F2003.
Yes, but a standard conforming f03 program may be interpreted as
an f95 program with extensions.
C:\gfortran\clf\confusion>type confusion.f90
module mod
implicit none
contains
subroutine sub(x,label)
integer x(:,:)
character(*) label
character(80) fmt
write(*,'(a)') label//' ='
write(fmt,'(a,i0,a)') '(',size(x,2),'i3)'
write(*,fmt) transpose(x)
end subroutine sub
end module mod
program confusion
use mod
implicit none
integer, allocatable :: x1(:,:)
integer, allocatable :: y1(:,:)
integer, allocatable :: x2(:,:)
integer, allocatable :: y2(:,:)
integer i
allocate(x1(2,3))
x1 = reshape([(i,i=1,size(x1))],shape(x1))
allocate(y1(3,2))
y1 = 1
allocate(x2(3,2))
allocate(y2(2,3))
x2 = x1
y2 = y1
call sub(x1,'x1')
call sub(x2,'x2')
call sub(y1,'y1')
call sub(y2,'y2')
call sub(matmul(x2,y2),'matmul(x2,y2)')
end program confusion
C:\gfortran\clf\confusion>gfortran confusion.f90 -oconfusion
C:\gfortran\clf\confusion>confusion
x1 =
1 3 5
2 4 6
x2 =
1 3
2 4
3 6
y1 =
1 1
1 1
1 1
y2 =
1 1 1
1 1 6
matmul(x2,y2) =
4 4 19
6 6 26
9 9 39
C:\gfortran\clf\confusion>ifort /check:bounds confusion.f90
Intel(R) Fortran Compiler for Intel(R) EM64T-based applications, Version
9.1
Build 20061104
Copyright (C) 1985-2006 Intel Cor****ation. All rights reserved.
Microsoft (R) Incremental Linker Version 8.00.40310.39
Copyright (C) Microsoft Cor****ation. All rights reserved.
-out:confusion.exe
-subsystem:console
confusion.obj
C:\gfortran\clf\confusion>confusion
x1 =
1 3 5
2 4 6
x2 =
1 3
2 4
3 5
y1 =
1 1
1 1
1 1
y2 =
1 1***
1 1***
matmul(x2,y2) =
4 4***
6 6***
8 8***
We see the f03 behavior in neither compiler.
--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end


|