From
http://groups.google.com/group/comp.lang.fortran/browse_frm/thread/cf9a1ed1754c6f4a/ed236efb2be07bc0?tvc=1#ed236efb2be07bc0

The program
------------------------------
 program tmatmul
   implicit none
   integer, parameter         ::  nmax = 3
   integer                    ::  n = 2
   real, dimension(nmax,nmax) ::  B=0.0, C=1.0, X=0.0

   B(1,1) = 1.0
   B(1,2) = 2.0
   B(2,1) = 3.0
   B(2,2) = 5.0

   X(1:n,1) = matmul( B(2,1:n),C(1:n,1:n) )
   print *, X(:,1)
   print *, "  Should be: 8.0  8.0  0.0"
end program tmatmul
------------------------------

produces with gfortran (4.2.0 20060612 and 4.1.0 (SUSE Linux)):

   3.000000       3.000000       0.000000
   Should be: 8.0  8.0  0.0

ifort, g95 and NAG f95 give the correct result (8. 8. 0.0).


-- 
           Summary: gfortran: mathmul produces wrong result
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tobias dot burnus at physik dot fu-berlin dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28005

Reply via email to