This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/66873] fortran variant of outer-1.c not parallelized by autopar
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 14 Jul 2015 23:39:54 +0000
- Subject: [Bug tree-optimization/66873] fortran variant of outer-1.c not parallelized by autopar
- Auto-submitted: auto-generated
- References: <bug-66873-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66873
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #5 from kargl at gcc dot gnu.org ---
(In reply to vries from comment #0)
> Consider this example, a fortran version of autopar/outer-1.c:
> ...
> program main
> implicit none
> integer, parameter :: n = 500
> integer, dimension (0:n-1, 0:n-1) :: x
> integer :: i, j, ii, jj
>
> do ii = 0, n - 1
> do jj = 0, n - 1
> x(ii, jj) = ii + jj + 3
> end do
> end do
>
> do i = 0, n - 1
> do j = 0, n - 1
> if (x(i, j) .ne. i + j + 3) call abort
> end do
> end do
>
> end program main
> ...
>
> When trying to parallelize this using -O2 -ftree-parallelize-loops=2, it
> fails on the dependencies:
Does the loop ordering matter? Fortran is a column major language,
so your nested loops are backwards. One would normally write.
do jj = 0, n - 1
do ii = 0, n - 1
x(ii, jj) = ii + jj + 3
end do
end do
where the first loop index varies most rapidly.