'"In call to DSYEV, an array temporary was created for argument" in ifort but the related dimension is only 1

Related questions Temporary array creation and routine GEMM Warning message (402) : An array temporary created for argument

For the following Fortran code (modified from dsyev in fortran 90)

program test_dsyev   
implicit none  
integer, parameter :: dp = selected_real_kind(15, 307)
real(dp), allocatable  :: A(:,:), A2(:,:,:), work (:), w(:)  
real(dp) :: c1
integer :: i, j  
integer :: lwork, info,  n, lda  
character :: jobz, UPLO 

n=5
allocate(A(n,n))  
allocate(A2(1,n,n))  

A = 0.0_dp
c1 = 1.0_dp
do i = 1, n  
   do j = 1, n
     A(i, j) = i * c1 + j * c1  
   end do  
end do  
A2(1,:,:) = A

lda = n  
lwork = 10 * n  

jobz = 'N'
UPLO = 'U'
allocate(work(lwork))  
allocate(w(n))  
call dsyev(jobz,uplo,n,A,lda,w,work,lwork,info)  
write (*,*) w

call dsyev(jobz,uplo,n,A2(1,:,:),lda,w,work,lwork,info)
write (*,*) w
end program test_dsyev

called d.f90. ifort -mkl -warn all -check all d.f90 gives me

 -1.58312395177700      -1.465651932086313E-015  8.229374109843719E-018
  4.803282588162841E-016   31.5831239517770
forrtl: warning (406): fort: (1): In call to DSYEV, an array temporary was created for argument #4

Image              PC                Routine            Line        Source
a.out              0000000000408E86  Unknown               Unknown  Unknown
a.out              000000000040580B  Unknown               Unknown  Unknown
a.out              0000000000403812  Unknown               Unknown  Unknown
libc-2.17.so       00002B10A2A31555  __libc_start_main     Unknown  Unknown
a.out              0000000000403729  Unknown               Unknown  Unknown
  -1.58312395177700      -1.465651932086313E-015  8.229374109843719E-018

it seems the warning message is related to A2(1,:,:) and memory non-continuous. Yes, Fortran is column-major. But, the first dimension of A2 is 1. A2 should follow A2(1,1,1), A2(1,2,1),..., I mean, the first index of A2 does not play a role in memory allocation. Or am I totally wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source