http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46752
Summary: OpenMP - Seg fault for unallocated allocatable array
in firstprivate clause
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Test Case:
> cat test.f90
! derived from OpenMP test omp3f/F03_2_9_3_4_5c.f90
program F03_2_9_3_4_5c
use omp_lib
implicit none
integer, parameter :: NT = 4
integer, allocatable :: allocatable_array(:)
integer :: i
call omp_set_dynamic(.false.)
call omp_set_num_threads(NT)
!$omp parallel
! use schedule(static, 1) so each thread executes an iteration
!$omp do firstprivate(allocatable_array) schedule(static, 1)
do i = 1, NT
! Per OpenMP 3.0, p. 90, lines 33-34: "if the list item is "not
! currently allocated", the new list item will have an initial state
of
! "not currently allocated";
if (ALLOCATED(allocatable_array) .neqv. .false.) then
print *, "FAIL - ALLOCATED(allocatable_array) == .true.", &
" (expected .false.)"
end if
end do
!$omp end parallel
end program F03_2_9_3_4_5c
> gfortran -fopenmp test.f90
> ./a.out
Fortran runtime error:
[the remaining text after error: appears to be missing, including the newline
character.]
The code executes when compiled with other compilers, and produces no output.