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

    <tr>
        <th>Summary</th>
        <td>
            [flang] SELECTED_REAL_KIND folding bug on aarch64
        </td>
    </tr>

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

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

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

<pre>
    ```
program main
  integer, parameter :: K = selected_real_kind(16)
  real(K) :: my_x = 3.14159265358979
  interface
    subroutine c_func(b)
      integer, parameter :: K = selected_real_kind(16)
      real(K) :: b
    end
  end interface
  call c_func(my_x)
end
```
```
$ flang-new -fc1 -emit-llvm fortran_main023.f90
$ cat fortran_main023.ll 
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target triple = "aarch64-unknown-linux-gnu"

@_QFECk = internal constant i32 10
@_QFEmy_x = internal global x86_fp80 0xK4000C90FDB0000000000

declare ptr @malloc(i64)

declare void @free(ptr)

define void @_QQmain() !dbg !3 {
  call void @c_func_(ptr @_QFEmy_x), !dbg !7
  ret void, !dbg !9
}

declare void @c_func_(ptr)
```
The expected type size for variable `my_x` is 128 bit on aarch64.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVMlu2zAQ_RrpMrBBUbKWgw5J7ABB0qJpcxcoaSSzoUmDolKnX9-hvCdFTyVoc5k3wzfDR9WmfS-DlB06WwbsZmtNb8UGNkLq_Q6A1A57tAG_g60gIzq0EMQ31OGRJksYUGHjsK0sClW9St0GPI_SgBfHGN5Ae4-0dXTdvFe7yTueR0m0KHi6iBd5kRWX59pONHjcABjG2prRSY3QVN2oG4pZXxzj2_-g69tfKNdnO5LTYUHTz1wbodSZo8_1FP7k-qH2H5c8gU4J3c80_oJZ10Qww410M6XeNtAZ66zQlb8oxuN5V1y4NcJ9AhCdAyC-hS-mHRU-LKdyBDy7f_i-36L5HjWY0TZYdVKhphoegPwCyPdAJ2yPDpyVW3WCCWGbdZrMRv2qzS89U1KPu1mvx5Pb4T9h1fP96u51cpyKqAXVzejBCe1AxhwidoU9yeaE7pWpadjladVtcwZs95gwxu4Kdr-8Zad2eW6LjRIWYetIGgnb0GUZf08yTU7XdI18M7L10M4i5Z6T4ydg52V5xFXPz9Mb4vmkHx61de-HGILs9kokR4-9WKp9cLjI1h9EYj7HyM6vyk3u1-YjrWz5r0Sujjvncq3BlzUC7rbTawH3vkUY5G_02oI3YaWo_ZWnbGKZMpADRDyHWjowGg4imIdYRmka0ROPcxa2ZdwWcSFCJ53CMljcTiIPFkv4sXpa3b2sltX31c1T9fjwdUknqVbqHuqxvwgZjlaVa-e2g3-Y_J56L916rOeN2dDCv5DDMKMv2k_iT0s5DCMONFlkPIvDdZmmdd7Facw4XySRyJqMJTUK1sQixzTjoRI1qsFzJN3uacY3nTWkPP_N4EQ6lCUnf5bTr2BFwubpom4azlhb8LpuWE61RpKCmns6c2P70JYTM8ppIKOSgxvORjEMstc4VcbHF6NbG1t-Q7mT-lkKE055lFMSfwBFJ6xI">