Silverfrost Forums

Welcome to our forums

strange behaviour of the intrinsic \"sum\"

14 Apr 2016 2:01 #17418

Hello Paul, i need your help. Below i have embedded a little program, which demonstrates that something going wrong with the Salford Compiler V7.20.

program strange_bug
  implicit none
  integer, dimension(3) :: array = (/ 2, 1, 3 /)
  integer sum1, sum2, sum3, sum4, sum5, sum6             ! SALFORD         ! INTEL   14/4/2016
  sum1=-1; sum2=-1; sum3=-1; sum4=-1; sum5=-1; sum6=-1   ! ------------------------
  sum1 = sum(array(:), mask = array      .ne. 1 )        ! sum1 = 5        sum1 = 5
  sum2 = sum(array(:), mask = array       /=  1 )        ! sum2 = 5        sum2 = 5
  sum3 = sum(array(:), mask = array(2)   .ne. 1 )        ! sum3 = 1        sum3 = 0
  sum4 = sum(array(:), mask = array(2)    /=  1 )        ! sum4 = 3        sum4 = 0
  sum5 = sum(array(:), mask = array(3)   .ne. 1 )        ! sum5 = 2        sum5 = 6
  sum6 = sum(array(:), mask = array(3)    /=  1 )        ! sum6 = 3        sum6 = 6
  write(*,*) sum1, sum2, sum3, sum4, sum5, sum6
end program strange_bug

The results obtained using the Intel compiler seems to be OK. But the Salford results are very strange. Especially the differences between sum3 and sum4 and between sum5 and sum6

14 Apr 2016 3:32 #17419

Thanks for the feedback. I have logged this for investigation.

12 May 2016 9:54 #17474

This bug has now been fixed for the next release (i.e. the one after 8.0).

Please login to reply.