<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/148386>148386</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Flang OpenMP doesn't appear to correctly process metadirectives in .F files and warn the user its not yet implemented.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
scamp-nvidia
</td>
</tr>
</table>
<pre>
Testing SPEC Accel V2 OMP has presented an issue with how Flang OpenMP processes .F files when metadirectives are used. Consider the following example:
test.F
```
#define OMP_TARGET .true.
#define OMP_SIMD .false.
program test
implicit none
integer i,j,n
n = 100
!$omp metadirective
!$omp& when(user={condition(OMP_TARGET.or.OMP_SIMD)}:
!$omp& target teams distribute parallel do )
!$omp& default(target teams loop)
do i=0,n
do j=0,n
write(*,*) "Test"
enddo
enddo
return
end program
```
If I try to compile this with a recent Flang build, it "appears" to compile correctly using the OpenMP directive. However, it entirely ignores it as a comment instead, I suspect. Whereas, if I copy the same .F file to a .F90 file, then I correctly get an error message telling me that Flang does not yet have metadirectives implemented.
```
scamp@genx4:/local/home/scamp/450.md_lop_1$ flang test.F -fopenmp -fopenmp-version=50 -c
warning: OpenMP support for version 50 in flang is still incomplete
scamp@genx4:/local/home/scamp/450.md_lop_1$ cp -f test.F test.F90
scamp@genx4:/local/home/scamp/450.md_lop_1$ flang test.F90 -fopenmp -fopenmp-version=50 -c
warning: OpenMP support for version 50 in flang is still incomplete
error: loc("/local/home/scamp/450.md_lop_1/test.F90":6:7): /proj/build/llvm/Linux_x86_64/flang/lib/Lower/OpenMP/OpenMP.cpp:3495: not yet implemented: METADIRECTIVE
LLVM ERROR: aborting
```
Obviously this behavior could lead to user confusion.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8VU9v47gP_TTKhajhyM6_gw-eJP79AkzRQaeYPRayRNsqZEmQ5KT59gvZSZp29rDALtYoGk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