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

    <tr>
        <th>Summary</th>
        <td>
            [flang][openmp] omp_lib does not work when `-fdefault-integer-8` is specified
        </td>
    </tr>

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

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

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

<pre>
    ```
subroutine bug_with_default_integer_8(i)
  use omp_lib, only : omp_set_num_threads
 integer :: i
  call omp_set_num_threads(i)
end subroutine
```

`flang -fdefault-integer-8 -fopenmp -c`:

```
error: Actual argument type 'INTEGER(8)' is not compatible with dummy argument type 'INTEGER(4)'
```

The opemp standard mandates the signature of omp_set_num_threads to be the default integer, so I think it should work even when the default integer is mapped to something else than integer(4).

gfortran succeeds compiling this example with -fdefault-integer-8, and so does nvfortran with `-i8`. Note that ifort/ifx however compiles with a warning about interface mismatch and most likely produces broken code.

Maybe omp_lib methods should be implemented as generic interfaces allowing multiple kinds?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VEvP4jgQ_DXOpQUKDgnhkAOz37Caw45Wq7kjPzqJBz8iP2D49ysn-WClRSMhWURd3VXVZbMQ1GARO1J_IfVHwVIcne9-IrN_o1foC-7koyNNuf7KU0jcuxSVReBpuNxVHC8Se5Z0vCgbcUB_aQltFaFHUp4AUkBwZrpoxQn9A5zVDyDVaf4WMF5sMpc4emQy5Pq1Ry7JVWruIZjWbwHPOWglvKiR8vRfzsvfXjM7wKZf2W7WSZsWNr2b0JoJNiIDqtMT82yB3jufCZ1ETEwD80MyaCPEx4RA6OHb9x9f__z6D6FtmxnRA6gA1kUQzkwsKq4RslkgkzGP3-H3C_7_Gn6MCG5CM0GIzErmJZh8RgwQR4S8SxaTR3D9O7cgOuA4l64efLqdFxMcfIM4KnsFFSGMLmkJd-evgDe0cB_RvoNmmYZNE8rcPjiDuccAqEMexexrxqxsu2gZeuejZxZCEgJRhtknpTM0jioA_mJm-vTszdIyZZaX7kA6DGBvnx1nBGnKjWpJU27hu4szkwgqlxB6Vv0vGN0db-jXsRgWGIM78zaTYNylRaTvmUAwKhgWxTgPNS5E0OqK-gGTdzIJDMC9u6IF4SSuIv9iD_4MP2RnnAyf1nIElRXmFKAEFmBAi16J19AATGt3z3RM0lFlP67KykCqcyG7Sh6rIyuw2x2qQ103h6opxk7umvbQSF4euNgfd1TUPWIv6bHiSCXDQnW0pHW5o3S3r9q62WIrsd03x1Zw2u9LQfYlGqb0Vuub2To_FCqEhN2OVsd9W2jGUYf5yaB0vlSkOi0XiFCanxHfZeSGpyGQfalViOHVK6qo5wdngdYfpP6youuPp1nLTl1cEjiHL6_0TQ6aMkcwTChUr1AWyetujHEK-R7TM6HnQcUx8a1whtBz5rEem8m7nyjmRGSBgdDzqvHW0X8DAAD__0iztbE">