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

    <tr>
        <th>Summary</th>
        <td>
            Undefined reference for iso_fortran_env xxx_kinds
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    When trying to build HDF5 with Clang/Flang-new, I got the following error

```
/usr/bin/ld: /tmp/aclocal_fc-eba825.o: in function `_QQmain':
FIRModule:(.text+0xbe): undefined reference to `_QMiso_fortran_envECinteger_kinds'
/usr/bin/ld: FIRModule:(.text+0x359): undefined reference to `_QMiso_fortran_envECreal_kinds'
/usr/bin/ld: FIRModule:(.text+0x5ef): undefined reference to `_QMiso_fortran_envEClogical_kinds'
```
It can be circumvented by defining a temp variable.

Note that this happened with flang-new version **17.0.6** from https://aur.archlinux.org/packages/flang, so it might be that the bug is fixed already or that it is related to a non-standard installation.

The code for reproducing is attached, originally it had the *.f90 extension.

[aclocal_fc.txt](https://github.com/llvm/llvm-project/files/15451097/aclocal_fc.txt)
[aclocal_fc_fixed.txt](https://github.com/llvm/llvm-project/files/15451098/aclocal_fc_fixed.txt)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyslFGPozYQxz-N8zJaZEwI8MBDdlPUfdhKV7XqYzTYA7jn2JFtsuTbVya7usv17qHbkxAGjOf_n_FvjCHo0RK1rHxk5WGDc5ycb1_QHzRNZtM7dW3_mshC9FdtR4gO-lkbBb8euhJedZzgyaAdmei6ND5YemXiCZ5hdBHiRDA4Y9xrWkveO8_4gfH9233H367bq-jm4Jnoem2Z6IxixR6Y6OLpzESH0jiJ5jjIB-qxFmXm0ry2MMxWRu0ssB0_fvp0wrS8YsWbSvf8-4tTs6H0RdRZpCUy8ciXnphoUozZKhq0JQWeBvJkJaVE13AvOrjj4Hz0aI9kL788aRtpJH_8rK0KSejH5n8oXZTNh7Q9oflfwiUNHxI2btTy39r3G_gcQaKFnkBqL-fThWwkBf0VVqnEAEKk0xku6DX2hrKvcfjNRYI4YeJGB5jwfKbkb6VseKcLLuTDuttiz8Q-rzKe7W7PMHh3ginGc1jz7hI2s8_Qy8loOy-Z84nUM8rPOFJgohtu8D5BcKAjnPQ4xZTAmw2Cfh5BBxj0QgrQeEJ1BedvP-iY5jwZTHlGBwjW2YcQ0Sr0CrQNEY3BROddqn9MBNKp1B0ePJ29U7NM9dEBMEaUE6nkynk9aovGXJPWhGr1xMQ-GxoOtESy4dvYrHz80itZXCIrD0zU92UZdZzmPpPulJgxl_fh4ezd3yRjKo02a4nyclvmvKnuenCNK5rvKB7XUv083fpO96vo7-ob1RaqKRrcUJtX-a6qd1VebKZW8Qqboiq2NVdDUzVDvlU11jKvGt5sh3yjW8HFlpei4mWel0XGd1QXkjc5rypey4FtOZ1QmyxZTPBsdAgztU2x3fKNwZ5MWI9OIRKZ6yQTIp2kvl3T6ucxsC03OsTwJUrU0VD753c6MPHwTfPBsiy3vtvM3rT_uZ6rq1TQm-tLK_4JAAD__48a6vw">