Look at this:

$ cat allocate-loop.f90
program main
  implicit none
  real, allocatable, dimension(:) :: a, b, c
  real, dimension(10) :: d, e, f
  real :: s
  allocate (a(10), b(10), c(10))
  call random_number(a)
  call random_number(b)
  c = a+b
  s = sum(c)
  print *,s
  call random_number(d)
  call random_number(e)
  f = d+e
  s = sum(f)
  print *,f
end program main
$ gfortran -march=athlon-xp -O3 -ftree-vectorize -ftree-vectorizer-verbose=4
allocate-loop.f90

allocate-loop.f90:15: note: not vectorized: unsupported use in stmt.
allocate-loop.f90:14: note: LOOP VECTORIZED.
allocate-loop.f90:10: note: not vectorized: unsupported use in stmt.
allocate-loop.f90:9: note: not vectorized: unhandled data-ref
allocate-loop.f90:1: note: vectorized 1 loops in function.

The loop at line 9 (c=a+b) could be vectorized if the stride was
known to be 1 (which isn't made known to the middle end in this case).


-- 
           Summary: knowing that stride==1 when using allocated arrays
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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

Reply via email to