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

Sub-array passing to a subroutine

gryvon
Beginner
460 Views
The code below works fine when compiled by IFC 8.1 but works wrong when compiled by IFC 9.0
I'd be grateful if anybody would explain is it a compiler bug(!?) or I need to specify some option in the new compiler version, etc.
Normally, I expect two similar pairs of numbers on the screen, if the sub-array is transferred correctly between the modules.
c*******************************************************
program pbug
implicit none
external :: sbug
integer*4 :: i, j
real*8, dimension(1:5, 1:5) :: b
forall (i = 1:5, j = 1:5) b(i, j) = dble(i + j)
write (6, *) b(2, 4)
write (6, *) b(3, 4)
write (6, *)
i = 3
j = 4
call sbug(b((i - 1):i, j))
stop
end
c*******************************************************
subroutine sbug(p)
implicit none
real*8, dimension(1:2), intent(in) :: p
write (6, *) p(1)
write (6, *) p(2)
return
end
c*******************************************************
0 Kudos
1 Reply
Steven_L_Intel1
Employee
460 Views
I'm guessing that you don't have the latest update to 9.0, 9.0-21. There was a bug in some earlier versions of the nature you encountered, but it is fixed in 9.0-021 (I just tried your example.)
0 Kudos
Reply