[flang-commits] [flang] [flang] Allow OpenMP declarations before type declarations (PR #112414)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Wed Oct 16 10:16:35 PDT 2024


luporl wrote:

> What happens if implicit typing is required? For example,
> 
> ```
> subroutine s1
>   save x1
>   !$omp threadprivate (x1)
> end subroutine
> ```

It works fine, the implicit type is set later, in `ResolveNamesVisitor::FinishSpecificationPart` for the example above.
We can check that it is set to `real`/`f32` in HLFIR:
```
  func.func @_QPs1() {
    %0 = fir.address_of(@_QFs1Ex1) : !fir.ref<f32>
    %1:2 = hlfir.declare %0 {uniq_name = "_QFs1Ex1"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
    %2 = omp.threadprivate %1#1 : !fir.ref<f32> -> !fir.ref<f32>
    %3:2 = hlfir.declare %2 {uniq_name = "_QFs1Ex1"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
    return
  }
```

https://github.com/llvm/llvm-project/pull/112414


More information about the flang-commits mailing list