Array operations 2003 verus 95 allocatable question


In the release notes for 18.10, the issue with array operations with the new 2003 allocatables are mentioned:

  real, allocatable, dimension(:) :: a, b
  allocate(a(100), b(100))
  a = 3.14

  !$acc kernels
  a = b
  !$acc end kernels

The example code can be modified to use an array section assignment instead; the compiler can parallelize the array section assignment and the lost performance is regained.

  a(:) = b(:)

My question is: Does the trick of using “(:)” work to avoid the slowdown for scalar assignments as well?
Such as:



It should just optimize out to just a memset:

      4, Memory set idiom, loop replaced by call to __c_mset4
      6, Memory copy idiom, loop replaced by call to __c_mcopy4