program dynamic_array implicit none !rank is 2, but size not known real, dimension (:), allocatable :: darray integer :: b1, b2, e1, e2 integer :: i, j ! print*, "Enter the size of the array:" ! read*, e1 b1=0 e1=5 ! allocate memory allocate ( darray(b1:e1) ) do i = b1, e1 darray(i) = i print*, "darray(",i,") = ", darray(i) end do !$acc kernels copyin(darray(b1:e1)), copyout(darray(b1:e1)) !$acc loop do i = b1,e1 darray(i) = -i end do !$acc end kernels do i = b1, e1 print*, "RET(",i,") = ", darray(i) end do deallocate (darray) end program dynamic_array