<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/80633>80633</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP] Compilation error with default (none) clause and do-construct-name combination
</td>
</tr>
<tr>
<th>Labels</th>
<td>
openmp,
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang-new : 19.0.0(730f498c961f29691a605028f9b1cd6d9e232460)
```
`do` loop with `do-construct-name` in `parallel do` construct with `default (none)` clause results in a compilation error.
gfortran and ifort are compiled successfully.
Compilation ends normally in the following cases:
- Do not specify `-fopenmp` for compilation option or
- `default (none)` clause unspecified or
- `default` clause with `private`, or `firstprivate`, or `shared` instead of `none`
The following are the test program, Flang-new, Gfortran and ifort compilation result.
z01.f90:
```fortran
subroutine find_surface_neighbor
integer(kind=4) :: i, j, nsurf
integer(kind=4) :: ncand, js
integer(kind=4), allocatable :: indexSurf(:)
!$omp parallel do default(none), &
!$omp&private(i,j,ncand,indexSurf,js), &
!$omp&shared(nsurf)
do i=1,nsurf
allocate(indexSurf(ncand))
JLOOP: do js=1,ncand
j = indexSurf(js)
if( i==j ) cycle
cycle JLOOP
enddo JLOOP
deallocate(indexSurf)
enddo
!$omp end parallel do
end subroutine find_surface_neighbor
$
```
```
$ flang-new z01.f90 -c -fopenmp
error: Semantic errors in z01.f90
./z01.f90:11:6: error: The DEFAULT(NONE) clause requires that 'jloop' must be listed in a data-sharing attribute clause
JLOOP: do js=1,ncand
^^^^^
./z01.f90:14:15: error: The DEFAULT(NONE) clause requires that 'jloop' must be listed in a data-sharing attribute clause
cycle JLOOP
^^^^^
./z01.f90:15:12: error: The DEFAULT(NONE) clause requires that 'jloop' must be listed in a data-sharing attribute clause
enddo JLOOP
^^^^^
$
```
```
$ gfortran z01.f90 -c -fopenmp
$
```
```
$ ifort z01.f90 -c -qopenmp -diag-disable=10448
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVk1v2zgT_jX0ZSCDoj4iHXxI4_oFXnSbAu3utaDEkU0vTaok1W721y9Gkh05yWbTUw3DhkYzz8w880HKEPTeIm5Y8Y4V25Uc4sH5jTtYl3THVePUw4aVfP7yLeO3f6AP2llwHXRG2n1i8Qew7BbSes3XnInqJuNdXldtXaadqMs6lSUvuKi6uklbVaoaRSbykjNRT5BPPFyEyrGSg3Guhx86HmAUJa2zIfqhjYmVJyQNbelVL700Bg1MZhe1R1vs5GAiMFFZZ5Hck56RQ0DwGAYTA2FJaN2p10ZGyhO9d34NMEW175yPXlqQVoGmB5AeZwNUEIa2xRC6wZiH9TKduyWkVQGs8ydpzAN5jAeEzhnjfmi7h1YGDCybDRPYOrAuQuix1d0DZZJ0rkd76in-zvmreF0__fmz-X9lPtgJWaN60Wqhemay9_q7jMQ9E3fgPMk67UN86UU4SI9qqlOIKBW1Div5GMl1zb9c8UDEEjMRQ4Teu72XJ4LdnduOHv73vCBLNqayXlXib56uu5pfCL5034w0ScPQeDdEbRE6bdXXMPhOtvjVot4fmjNPoG3EPXomqj-1VSzb5kzUNA40EZoCPNKPJfPZ5HUb20qrRrvwmgvSkMa4VkbZGLx4tAr_-ky-REWiy4RNvyJlInenHhazAucyP_aGuAMmyic2TJTn6oqKMqPEztEu_N4dw2sYczeIaqLkHCBQJJpl25RQF2zNSY5OF8nNjusFAAD8_8P9_SfiQTnib0YbVR-VAOAILNtekTUFfaWkST7GxLLtEahG7UNr8FprFM2OpxdolXJXEvoofDmTi9PR7Gmd0KplrabXJHxbezKRv75hr4QiX2z0eUogaeGybSbvtA-J4894kjbqdtqQ4-Y8j9aouGZi9zhracqy25LsLgA07dv3u9vfP3xhovp4__H9yPF5H38btMcA8SBpcd0c6Rxg4gZOQ4jQIBgdIqppYSsZZUKtNe6NGL1uhogz1lXB3tgirHh_9X0po5x-il-f0otd-OTzlnwolVT8-nyeD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