Fortran subroutine arguments should be marked as
__restrict__.  Currently, the following code isn't
vectorized:

$ cat loopsum.f90
subroutine foo(a,b,c,n)
  real, dimension(n), intent(in) :: a,b
  real, dimension(n), intent(out) :: c
  do i=1,n
    c(i) = a(i)+b(i)
  end do
end
$ gfortran -O -S -ftree-vectorize -ftree-vectorizer-verbose=5 loopsum.f90

loopsum.f90:4: note: not vectorized: can't determine dependence between: (*a_18)
[D.527_17] and (*c_25)[D.527_17]
loopsum.f90:1: note: vectorized 0 loops in function.
$ gfortran -v
Using built-in specs.
Target: ia64-unknown-linux-gnu
Configured with: ../gcc-4.1-20050508/configure --prefix=/home/zfkts --enable-
languages=c,f95
Thread model: posix
gcc version 4.1.0 20050508 (experimental)

-- 
           Summary: mark subroutine arguments __restrict__
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to