This one turned up during my testing of SPREAD on wide character strings, but
it turns out that it already happens on default character variables. It looks
like the front-end doesn't fill the return array descriptor well.

$ cat k2.f90
  implicit none
  character(len=5), dimension(3,3), parameter :: &
    p = reshape(["", "", "", "", "", "", "", "", ""], [3,3])
  character(len=5), dimension(3,3) :: m1

  m1 = p
  if (any (spread (p, 1, 2) /= spread (m1, 1, 2))) call abort

end
$ gfortran k2.f90 && ./a.out 
Fortran runtime error: rank mismatch in spread()

The most amazing is that it's specific to character variables (ie it doesn't
happen with integer, for example).


-- 
           Summary: SPREAD gives wrong results with CHARACTER variables
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        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=36257

Reply via email to