Joined: 27 Sep 2004
|Posted: Mon Sep 27, 2004 2:30 am Post subject: Matmul problem
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?
PS Code enclosed here - consists of one module and one program.
REAL( KIND = 8), ALLOCATABLE, PUBLIC :: ARRAY(:,:)
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/)
END SUBROUTINE INIT
END MODULE GLOBAL
REAL( KIND = 8) :: TEMP(8)
TEMP = (/1,2,3,4,5,6,7,8/)
PRINT*, MATMUL( TEMP(1:8), ARRAY(1:8,5:5) )
PRINT*, SUM( TEMP(1:8) * ARRAY(1:8,5) ) !should be the same