[Omp] PARALLEL DO REDUCTION of array-valued variables?

Daniel Franke franke.daniel at gmail.com
Sat Oct 28 14:21:30 PDT 2006


Hi all.

The code below crashes GNU as well as INTEL fortran compilers. 

If either "func" is not array valued or not listed in the REDUCE-clause,
everything is fine (at least, from the compiler's point of view).

$> cat omp.f90
PROGRAM omp
  write (*,*) func(n)

  CONTAINS
   FUNCTION func(n)
    INTEGER, INTENT(in)   :: n
    INTEGER, DIMENSION(n) :: func
    INTEGER               :: k

    func = 0
    !$OMP PARALLEL DO PRIVATE(k), REDUCTION(+:func)
    DO k = 1, n
      func = func + 1
    END DO
    !$OMP END PARALLEL DO
   END FUNCTION
END PROGRAM


Could someone be so kind to comment on what is wrong?

Thanks
	Daniel


P.S. Detailed reports of compiler crahes:
gfortran: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29629
ifort: If someone from INTEL reads this, where is one supposed to report ICEs?


More information about the Omp mailing list