<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56717>56717</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] semantic checks not implemented in OpenMP reduction clause
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
PeixinQiao
</td>
</tr>
</table>
<pre>
```
$ temp2.f90
program main
integer :: x(10)
integer :: i = 1
x = 0
!$omp parallel num_threads(4)
!$omp do reduction(+:x(1))
do i = 1, 10
x(1) = x(1) + i
enddo
!$omp end do
!$omp end parallel
print *, x
end
```
```
$ cat run.sh
#!/bin/bash
echo "---------- gfortran ----------"
gfortran $1 $2 && ./a.out
echo && echo "---------- classic-flang ----------"
flang $1 $2 && ./a.out
echo && echo "---------- flang-new ----------"
#flang-new $1 $2 && ./a.out
flang-new -flang-experimental-exec $1 $2 && ./a.out
$ bash run.sh -fopenmp temp2.f90
---------- gfortran ----------
temp2.f90:9:24:
9 | !$omp do reduction(+:x(1))
| 1
Error: Syntax error in OpenMP variable list at (1)
temp2.f90:13:14:
13 | !$omp end do
| 1
Error: Unexpected !$OMP END DO statement at (1)
---------- classic-flang ----------
F90-S-0034-Syntax error at or near ( (temp2.f90: 9)
0 inform, 0 warnings, 1 severes, 0 fatal for main
---------- flang-new ----------
55 0 0 0 0 0 0 0 0 0
```
```
$ cat temp5.f90
program main
type t
integer :: x
end type
integer :: i = 1
type(t) :: mt
mt%x = 0
!$omp parallel num_threads(4)
!$omp do reduction(+:mt%x)
do i = 1, 10
mt%x = mt%x + i
enddo
!$omp end do
!$omp end parallel
print *, x
end
$ bash run.sh -fopenmp temp5.f90
---------- gfortran ----------
temp5.f90:11:25:
11 | !$omp do reduction(+:mt%x)
| 1
Error: Syntax error in OpenMP variable list at (1)
temp5.f90:15:14:
15 | !$omp end do
| 1
Error: Unexpected !$OMP END DO statement at (1)
---------- classic-flang ----------
F90-S-0034-Syntax error at or near % (temp5.f90: 11)
0 inform, 0 warnings, 1 severes, 0 fatal for main
---------- flang-new ----------
0.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzdVktzmzAQ_jVw2TEjBPLjwCGJ41ubdjo9d2SQjVoQjBCJ8--7EsbYgTRpJp3MFAsZrZbdb59iW2WPiTcnx0HWHrnyaAxGlDUNdqsjqdbVXvMSSi5VRwGQyoi90OBFVzjg4NFlSDy6emZf4sMawqOKI8_BEckl0aMhQqjKGmqueVGIAlRb_jC5FjxrUE18pmVgzirQImtTIyuFTB69RrUOlWUf3kC-Hgu9gZD0dICe2e0OC3oNsmcSKsuqsW4kw3P03ohLI2uN_kHOKwvi0FGR-8j0JCDj-KTcgG5V0OTQEyOndrPFCOHMm_xcoUjzCrXR2emC_a7SRnMFAw0ZOvbTHuoK7URxmuOAAIXzoGrNhHTHMKEpLXjTyHS2K7jaT6nrNt5FlxM1U-JhSg86adh_Sd2ZpO5RHGqhZSmU4QUuRPpKxDZeNh59wGa7qhYKs-NUZMcYvhAcxzMUZnS1wpvGtr4uUgsAk3ZxA28pDnt1705ex_K91brStqi_PaIzDiDsGgse7tCwT1_gnmvJt4WAQjYGuM3zTtHIhDCy04QNYTSy4bLIJpE-xfdd2aClRmRHOXeI7vbzGtZ30BiOSDCaI4CjaDybwI5xsyKzbzNConh24Q8Ui7MSXFvx9j63HM7dTtB5GPHSNgO7euBaSbVvunUIjbgXWrglgR3HBARkP2vHI8iTddBpYwyFPPn9Td-xVrCztJ06HMxjLcAMsRodFkM_dbyvOTQ6qdaNXY92HKW5TBxcU_bPj5VOy6sOlTNA_eMHHCh_akHsDS2I9fUb2h7EJuo3fF0PGnnyhQ70fi3oZAJ7rgWx_6sFsb4F9ZZjkD6qB5Hg4oTsG40vknDOlktC6Sr0syTKVtGK-0aaQiQeu95YiR5bI5iSKyNTSHOR_mpAVQZkWRfOm-jqIRFOKWdd2DbCb3WR5MbUjY043eDYS5O32yCt0PZNUdz3fzPsbD8xdLiUTdNa2zdsvggXfp4ITlNKY0IyItJFHO8Wu3gVsSxdhjzChuIXfCuKxoLGzw_nCfsZwta-TCiaRxZ0jn8xI8F8uV0uw4hseRYtRDb3YoLWySKwGIJK732dODjbFqMRE5vRzbBp82KvhPOPlc9bk1c6-SLkQaqvkle-A5845L8B1T0jag">