$ cat fail.f90 
  implicit none
  real(8) :: a(2,9), b(9,7), c(2,7)
  integer :: i, j

  a = 0.d0
  b = 0.d0
  c = 1789789.d0
  c(:,1:7:2) = matmul(a,b(:,1:7:2))
  do i = 1, 7
    print *, c(:,i)
  end do
  end
$ ifort fail.f90 && ./a.out   
  0.000000000000000E+000  0.000000000000000E+000
   1789789.00000000        1789789.00000000     
  0.000000000000000E+000  0.000000000000000E+000
   1789789.00000000        1789789.00000000     
  0.000000000000000E+000  0.000000000000000E+000
   1789789.00000000        1789789.00000000     
  0.000000000000000E+000  0.000000000000000E+000
$ gfortran fail.f90 && ./a.out
   0.00000000000000        0.00000000000000     
   0.00000000000000        0.00000000000000     
   0.00000000000000        0.00000000000000     
   0.00000000000000        0.00000000000000     
   1789789.00000000        1789789.00000000     
   1789789.00000000        1789789.00000000     
   1789789.00000000        1789789.00000000


-- 
           Summary: incorrect matmul result
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org


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

Reply via email to