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

    <tr>
        <th>Summary</th>
        <td>
            [flang][OpenMP] DECLARE SIMD LINEAR implicitly declaring a variable
        </td>
    </tr>

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

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

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

<pre>
    https://github.com/fujitsu/compiler-test-suite/blob/ac5d63a278b47141b51e12bd7ec3b189177d63e9/Fortran/0683/0683_0009.f90

```
module mod
contains
subroutine sub(m,i)
!$omp declare simd linear(i:1)
 implicit none
  integer*8 i,n
  value i
  parameter(n=10000)
  real*4 a,b,m
  common/com1/a(n)
  common/com2/b(n)
  a(i) = b(i) + m
 i=i+2
end subroutine
end module
```

Reproduce with `flang -fopenmp`.

Currently this causes an error: `error: The type of 'i' has already been delcared` on the declaration of `i`. It is wrong that the LINEAR clause is implicitly defining the symbol. This should wait until after the symbol has been resolved for the fortran declaration and then use that.


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VE2P4ygQ_TWVS6kjXP6KDz64k7bU0szuqnfuKzDlmBEGC3C38u9XdjIzPXtYCQlc9V758QqQMZqrY26hfIbycpBrmnxok7JyOiivb-2U0hIh74B6oP5q0rSq4-BnoH5cv5sUV6B-8PNiLIenxDE9xdUkBuqV9Qqol0Opq1xSfVJFnRWZKjPOSOmah1xlpyara13l3AD1vQ8pSAfUi-qUP6Z_hBDNcWwEiG4blXgM0c1er5Zx9hpEN3iXpHERRBdXFfyajGOMqwI6zUBnA9RsfMqACj8vqHmwMjBGM2u0xrEMQCcDeZfdoWjmxZrBJHTe8RZA4xJfOQB1JzRAZ7dH36VdGc2-XmSQM6cNc3KQXzIhhHjUw8DSAnUFSqCzAjrPe3jw8-zd3chss2znPjifk7TZ-jkpd8XUIOQXVD8_6Bn3ygbyiwF6JhAdO42_jHkE7g7-x1YQ3Rsvwet1YPwwaUKoxGilu-LT6Bd28wKVON6R5zUEdsneME0m4iDXyBGlQw7BB8i7jfxz_W1iTLeF0Y8IVBugGicZUdrAUt9QMTvUbAcZWEMl0DtMEz96JZPxbqdWwmwS8DWhifgRvLtimmTawV9e_3jp3nCwm5Yt_6OP9oaaR-PMjmaMt1l5e8Rvm_I4-dVq_JAm4eqSsSjHxOETcFe6KwwcvX1njaO_A8b7yf1Np3R6yzncVGziHo4ddJvrJm_kgdusLuq6rE9ZcZjaOi_ygUp9qrKCVNOoXIiGxmoUsmDO84NpSVApShJZlVVlcTyJfCgbrQqpMlmShkLwLI09Wvs-H324HkyMK7dZIeqyOFip2Mb9shPtDQWi7d6HdiM8qfUaoRDWxBR_lUgm2f2FuDPKC5TPfy7svv4F5QUvL-cv3dsL_v369fLD-d_83gzZDJf4LoORyvJhDfb_Hpbtz4_paQn-Ow8JqN93EoH6x2beW_o3AAD__5gwee0">