https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103289
Bug ID: 103289
Summary: OpenMP: Private Allocatable arrays not allowed inside
'parallel' with default(none)
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: vzborovsky at gmail dot com
Target Milestone: ---
Hello,
This code does not compile:
program t
implicit none
integer, allocatable :: a(:)
integer :: j
!$omp parallel default(none)
!$omp do private(a)
do j = 1, 1000
end do
!$omp end do
!$omp end parallel
end program
Compiler fails with the error:
/app/example.f90:7:19:
7 | !$omp do private(a)
| ^
Error: 'a' not specified in enclosing 'parallel'
/app/example.f90:6:28:
6 | !$omp parallel default(none)
| ^
note: enclosing 'parallel'
Compiler returned: 1
The code above was tested against gfortran versions 4.9.4, 7.3.0, 10.2, 11.2.
Versions 4.9.4 and 11.2 were tested at godbolt.org site,
https://godbolt.org/z/caEEsvxc6
All versions above produce the same error.
But the code does compile when:
a) either I change the type of 'a' variable to fixed-size array
b) or declare 'a' as private in 'parallel' construct
c) or use combined 'parallel do' construct
d) or use Intel Fortran compiler
I have tried to read OpenMP specification but haven't found anything
prohibiting the code above.
With best regards,
Vadim Zborovskii