From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21620 invoked by alias); 2 May 2006 19:10:45 -0000 Received: (qmail 21604 invoked by uid 48); 2 May 2006 19:10:41 -0000 Date: Tue, 02 May 2006 19:10:00 -0000 Subject: [Bug fortran/27395] New: Problem with arrays in the OpenMP REDUCTION clause in Fortran X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "benjamin dot reveille at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-05/txt/msg00206.txt.bz2 List-Id: Below are 2 programs which test the REDUCTION clause for arrays in OpenMP. gfortran ICE's when trying to compile them. gfortran information: Using built-in specs. Target: i386-linux Configured with: ../gcc/configure --prefix=/cosmic/coudert/tmp/gfortran-20060502/irun --enable-languages=c,fortran --host=i386-linux --with-gmp=/cosmic/coudert/tmp/gfortran-20060502/gfortran_libs Thread model: posix gcc version 4.2.0 20060502 (experimental) Extra info: 1) xlf 10.1 and pgi 6.1 compile array_reduction1.f90 and execute it correclty intel 8.1 compiles array_reduction1.f90 but aborts on execution 2) xlf 10.1, pgi 6.1 and intel 8.1 compile array_reduction1.f90 and execute it correclty The openMP 2.5 Specifications (p83 of http://www.openmp.org/drupal/mp-documents/spec25.pdf) "2.8.3. Restrictions to the reduction clause": says : Fortran pointers, Cray pointers, assumed-size arrays and allocatable arrays may not appear in a reduction clause. In both programs it seems that the arrays are acceptable candidates for reduction. See http://gcc.gnu.org/ml/fortran/2006-05/msg00022.html for discussion about this bug report. array_reduction1.f90 ---------------------------------- program array_reduction1 implicit none integer, parameter :: n=10,m=1000 integer :: i integer, dimension(n) :: sumarray ! call foo1(n,m,sumarray) do i=1,n print*,sumarray(i) end do end program array_reduction1 subroutine foo1(n,m,sumarray) use omp_lib, only : omp_get_thread_num implicit none integer, intent(in) :: n,m integer, dimension(n), intent(out) :: sumarray ! integer :: i,j ! sumarray(:)=0 !$OMP PARALLEL DEFAULT(shared) print*,'hello from thread ',omp_get_thread_num() !$OMP DO PRIVATE(j,i), REDUCTION(+:sumarray) do j=1,m do i=1,n sumarray(i)=sumarray(i)+i end do end do !$OMP END DO !$OMP END PARALLEL end subroutine foo1 ---------------------------------- >> gfortran -fopenmp array_reduction1.f90 array_reduction1.f90: In function 'foo1': array_reduction1.f90:13: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See for instructions. array_reduction2.f90 ---------------------------------- program array_reduction2 implicit none integer, parameter :: n=10,m=1000 integer :: i ! call foo2(n,m) end program array_reduction2 subroutine foo2(n,m) use omp_lib, only : omp_get_thread_num implicit none integer, intent(in) :: n,m ! integer :: i,j integer, dimension(n) :: sumarray ! sumarray(:)=0 !$OMP PARALLEL DEFAULT(shared) print*,'hello from thread ',omp_get_thread_num() !$OMP DO PRIVATE(j,i), REDUCTION(+:sumarray) do j=1,m do i=1,n sumarray(i)=sumarray(i)+i end do end do !$OMP END DO !$OMP END PARALLEL do i=1,n print*,sumarray(i) end do end subroutine foo2 ---------------------------------- >> gfortran -fopenmp array_reduction2.f90 array_reduction2.f90: In function 'foo2': array_reduction2.f90:9: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See for instructions. -- Summary: Problem with arrays in the OpenMP REDUCTION clause in Fortran Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: benjamin dot reveille at gmail dot com GCC build triplet: i386-linux GCC host triplet: i386-linux GCC target triplet: i386-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27395