18.10 Fortran forall bug

Hi,

I have observed a very strange behavior when replacing two do loops with a forall statement

 program strange_forall 
                                                                                                    
  real, dimension(3,3,3,3) :: C,dS_dFe,dS_dFe2
  real, dimension(3,3) :: Fi, Fe
  integer :: i, j
  call random_number(C)
  call random_number(Fe)
  call random_number(Fi)
                                                                                                    
  do i=1, 3; do j =1,3
    dS_dFe(i,j,1:3,1:3) = matmul(Fe,matmul(matmul(Fi,C(i,j,1:3,1:3)),transpose(Fi)))
  enddo;enddo  
                                                     
  forall(i=1:3,j=1:3) &   
    dS_dFe2(i,j,1:3,1:3) = matmul(Fe,matmul(matmul(Fi,C(i,j,1:3,1:3)),transpose(Fi)))

  print*, dS_dFe - dS_dFe2
  
end program

I don’t see what is wrong here, but I would expect to get the same results in ‘dS_dFe’ and ‘dS_dFe2’.

I am running PGI community edition 18.10 on Ubuntu 18.04

Hi MarDie,

Thanks for the report. I have been able to reproduce the error here and created a problem report (TPR#27034). I’ve asked our compiler engineers to take a look to see what could be going wrong.

-Mat

Many thanks for the quick response