Hello,
I just get confused about ifort behavior.
Here is a minimal sample program causing me trouble :
program bug implicit none integer,parameter :: nb=1 integer,dimension(5,nb) :: array integer :: n n=1 do while (n<=size(array,1)) call fill(2,array(n,:),n) end do write(*,*) array contains subroutine fill(nb,vec,n) integer,intent(in)::nb integer,dimension(nb),intent(out) :: vec integer,intent(inout) :: n vec=n n=n+1 end subroutine fill end program bug
output :
0 1 2 3 4
And with -check all at compilation i got : "Subscript #1 of the array ARRAY has value 6 which is greater than the upper bound of 5"
Howerer, if i change
integer,dimension(nb),intent(out) :: vecto an assumed-shape form :
integer,dimension(:),intent(out) :: vecthe program behaves normally and the output is :
1 2 3 4 5.
This bug (?) does not appear when using gfortran instead of ifort.
ifort version : 12.1.0 20111011
Regards,
Simon.