<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/144563>144563</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang][OpenMP] Invalid restriction for linear(ref(x))
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
eugeneepshteyn
</td>
</tr>
</table>
<pre>
Test file:
```
subroutine test(omega0, g, tau)
!$omp declare simd(test) notinbranch linear(ref(omega0)) linear(ref(tau)) linear(ref(g))
real, intent(inout) :: omega0
real, intent(inout) :: g
real, intent(inout) :: tau
end subroutine test
```
Compile:
```
$ flang -c -fopenmp omp-linear-ref.f90
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: Semantic errors in omp-linear-ref.f90
./omp-linear-ref.f90:2:49: error: The list item `omega0` specified with the REF 'linear-modifier' must be polymorphic variable, assumed-shape array, or a variable with the `ALLOCATABLE` attribute
!$omp declare simd(test) notinbranch linear(ref(omega0)) linear(ref(tau)) linear(ref(g))
^^^^^^
./omp-linear-ref.f90:2:69: error: The list item `tau` specified with the REF 'linear-modifier' must be polymorphic variable, assumed-shape array, or a variable with the `ALLOCATABLE` attribute
!$omp declare simd(test) notinbranch linear(ref(omega0)) linear(ref(tau)) linear(ref(g))
^^^
./omp-linear-ref.f90:2:86: error: The list item `g` specified with the REF 'linear-modifier' must be polymorphic variable, assumed-shape array, or a variable with the `ALLOCATABLE` attribute
!$omp declare simd(test) notinbranch linear(ref(omega0)) linear(ref(tau)) linear(ref(g))
^
```
I checked OpenMP 5.2 and 6.0 specs, and I don't see that "REF 'linear-modifier' must be polymorphic variable, assumed-shape array, or a variable with the `ALLOCATABLE` attribute". I see that `ref` must be a dummy argument and must not have `value` attribute.
`ref` seems to be deprecated and checking with a recent ifx compiler result in `This form of the OpenMP* LINEAR clause is deprecated.` warning, but not an error.
Compiler version:
```
$ flang --version
flang version 21.0.0git (https://github.com/eugeneepshteyn/llvm-project.git 71f72f4d5d1b820a3e6147289547821332eaf115)
Target: x86_64-unknown-linux-gnu
Thread model: posix
...
Build config: +unoptimized, +assertions
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzslk1v4zYTxz8NfRlIoKg3--CDnMRAgDzPFlsDPRaUOJLYpUiBL16nn76g5GxedpHsrT0sYAQBOfzPzG-oGXLn5KAR96Q8kPJ2w4Mfjd1jGFAjzm70-Kg3rRGP-xM6D71USPKG0IZU9PqjjQutNcFLjeDRecK2ZsKBU8JuYIh_PA-E7eIplhFWmGkGgZ3iFsHJSRC2Xc_tQBsvdWu57kZQUiO3hG0t9i80d9Huzd7Vwfcbw7pMaAMAYJGrGI_UHnWMU2oTFr8xqbyBq4-ftB5-1jCGt5oS2qAW8JbYa543Zpp_CJqwAnrF9QBJB0lvZtTTDGaakzXtxGKf9jsa3Sx2Ccui_6_caqmH-O-nGfX_fgMX5tlYD1JfBaUD56VSgJcZrZxQe66AlIfkj5criZm9NJqUtzETa42Nor_jxLWXHSwrLqp-HxShTUrY8QcbecNI3hS7KPVN8zQiKOk8SI8TkIpea1NRcDN2spco4Kv0I_gR4fPdEQirr8KTEXHfElbDFJyHFmE26nEydh5lB2duJW8VxqJx58KEInEjnxG4tfwxLhsL_Jvdsx9S0ebh4dNNc2oOD3cxGO69lW3wuFT437zgpLx7-_sAefUB8uj1F--PeX-AeVu9j3n4BfldyK-b4D10I3ZfUDz1sjJlwLWAKl0puoWAFnAPwmjCag8OEfzIPRDG_gtUGUvh_kVUFY2JV_RbCBxEmKZH4HYIsfMu-Syb2ngY-XnRP3MV8JVyGmEtvK6CDnFy4E0UFThb7LhHscgtGKUe1pA5WOyiJ9lfoFsnkAWLLqhlTJCKnkbpoDd2AtMvKa4FIKyBh_v_3zWfoVM8OIzD5NlXGsN4mkDsBtqwJsH1-klcQ755cnlG6-KIeW_6JU9G1zn3dAhYltKUDjJWejt6P7uow46EHQf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