<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/144599>144599</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [flang][OpenMP] Wrong or unclear error message for Fujitsu test 0481_0038
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:openmp
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          eugeneepshteyn
      </td>
    </tr>
</table>

<pre>
    When compiling Fujitsu test [0481_0038.f90](https://github.com/fujitsu/compiler-test-suite/blob/main/Fortran/0481/0481_0038.f90) with OpenMP, get the following error:
```
$ flang -c -fopenmp 0481_0038.f90 
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: Semantic errors in 0481_0038.f90
./0481_0038.f90:9:4: error: The atomic variable yy should occur exactly once among the arguments of the top-level MAX operator
 yy=max(1,1,1 ,yy+1)
     ^^^^^^^^^^^^^^^^
```
Well, it seems that `yy` occurs exactly once among the arguments of `max`. Either this check is incorrect, or the the error message needs to describe the problem better.

This error started happening between commits 28a4ed945dc101c9a7dbdc93d9461da67225f7dc (known good) and e64f8e043cdfc394fd31e157c8c5fb25ca85bd2f (first discovered bad). I haven't done a bisect, but 141d390dcb6cd174b07ca663e58f37ab24eee08a looks like a candidate commit.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVE2L5DYQ_TXqS9GNLMtfhz54dtaQw5JAFia3oI-yrR1ZMpLcM_73Qe3ObiaBkBgZCVH1ql6V6okYzeQQr6R6ItXzSWxp9uGK24QOcY1zwt2dpNf79WVGB8ovq7HGTTBs30yKGySMCUj1RHlb_E5p2V7GjpLqmbB2TmmNpOwJGwgbJpPmTV6UXwgbxsObsOFAxHDOQOe4mYSEDdJ6SdiwCOMIGwYfUhD5lKM8th_BWAdvJs3w84ruyy-EfYIJE6QZYfTW-recLobgQ86F9qSmj0V7w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