Hi,
I’ve discovered what I think is a fault in the pgf90 compiler, version 4.0-2, involving the MATMUL command. The following code should multiply the vector v=(1,2,3,4,5,6,7,8) by an array segment a(:,5) (equal to v), but for some unknown reason seems to multiply v by a(:,1) instead.
Pgf90 gives the answer -204 (incorrect)
Ifc gives the answer 204 (correct)
Is it a bug, or a problem with my code?
Phil
PS Code enclosed here - consists of one module and one program.
MODULE GLOBAL
REAL( KIND = 8), ALLOCATABLE, PUBLIC :: ARRAY(:,:)
CONTAINS
SUBROUTINE INIT
IMPLICIT NONE
ALLOCATE(ARRAY(1:8,1:6) )
ARRAY = 0.0D0
ARRAY(1:8,1) = (/-1,-2,-3,-4,-5,-6,-7,-8/)
ARRAY(1:8,5) = (/1,2,3,4,5,6,7,8/)
RETURN
END SUBROUTINE INIT
END MODULE GLOBAL
program simple
USE GLOBAL
IMPLICIT NONE
REAL( KIND = 8) :: TEMP(8)
TEMP = (/1,2,3,4,5,6,7,8/)
CALL INIT
PRINT*, MATMUL( TEMP(1:8), ARRAY(1:8,5:5) )
PRINT*, SUM( TEMP(1:8) * ARRAY(1:8,5) ) !should be the same
STOP
END