Compiling this program with ifort version 15.0.1 gives me:
testarray.f90: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
compilation aborted for testarray.f90 (code 1)
Here is the code:
module test
implicit none
contains
function sum_assumedshape(input, length) result(output)
complex, dimension(:), intent(in) :: input[*]
complex :: output
integer, intent(in) :: length
integer :: i
output = cmplx(0.0, 0.0)
do i = 1, length
output = output + input(i)
end do
end function
function sum_assumedsize(input, length) result(output)
complex, dimension(length), intent(inout) :: input[*]
complex :: output
integer, intent(in) :: length
integer :: i
output = cmplx(0.0, 0.0)
do i = 1, length
output = output + input(i)
end do
end function
end module
program sizevsshape
use test
implicit none
complex, allocatable, dimension(:) :: in[:]
complex :: out
integer :: i
integer, parameter :: length = 4
allocate(in(length)[*])
in = (/(cmplx(real(i),0.0), i=1, length)/)
if(this_image() == 1) write(*,*) in
out = sum_assumedshape(in, length)
if(this_image() == 1) write(*,*) out
out = sum_assumedsize(in, length)
if(this_image() == 1) write(*,*) out
end program
When I compile this with ifort 14. it works but the assumed size function
gives me a wrong result.
Thank you
Jan