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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] The value of c_intmax_t defined in iso_c_binding is different for Flang and Gfortran/ifx.
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          ohno-fj
      </td>
    </tr>
</table>

<pre>
    ```
Version of flang : 21.0.0(f75126eeabba13ce2aab53c2e4296fca12b9da0d)/AArch64
```

While running the attached program, I noticed that the value of `c_intmax_t` defined in `iso_c_binding` is different for Flang and Gfortran/ifx.  
Flang is 16 and Gfortran/ifx is 8.  
```
$ grep c_intmax_t /work/groups/ssoft/compiler/llvm/aarch64/main-latest/include/flang/iso_c_binding.mod 
integer(4),parameter::c_intmax_t=16_4
$
```
Is there no problem that the value of flang is different from the value of gfortran/ifx?

The following are the test program, Flang, Gfortran and ifx compilation/execution result.

snfg1101_err077_2.f90:
```fortran
program main
  use , intrinsic :: iso_c_binding
  call csub1()
contains
  subroutine csub1()
 logical(c_intmax_t)        :: i_c_intmax_t
    i_c_intmax_t = .TRUE.
 print *,i_c_intmax_t
    print *,c_sizeof(i_c_intmax_t)
  end subroutine csub1
end program main
```

```
$ flang snfg1101_err077_2.f90
error: Semantic errors in snfg1101_err077_2.f90
./snfg1101_err077_2.f90:6:5: error: LOGICAL(KIND=16) is not a supported type
      logical(c_intmax_t)        :: i_c_intmax_t
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

```

```
$ gfortran snfg1101_err077_2.f90; ./a.out
snfg1101_err077_2.f90:6:11:

    6 |     logical(c_intmax_t) :: i_c_intmax_t
      |           1
Warning: C kind type parameter is for type INTEGER but type at (1) is LOGICAL
 T
                    8

```

```
$ ifx snfg1101_err077_2.f90; ./a.out
 T
 8

```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVktv3DYQ_jXcyyACRT1We9iDsrYCo0EKpG5zXFDUSMtEIgWScpz--mKkta11bTftpcIeFpzhPL5vHpTe684g7ln2nmVXGzmFk3V7ezL2Xft1U9vmx57l_Pzj5R_ovLYGbAttL00HLClBxBGPOBNFu81ikSPKupZxolBIWWeJEpiKXd4qGYt610jeMLFjoipLp055yni59sB4-eWkewQ3GaNNB-GEIEOQ6oQNjM52Tg5MHOAGjA1aYQPhJMOsdif7CSk2lnN11CYM8v4YWM6hwVYbbEAbkmlvj-pYa9No05FYe2h026JDE6C1Dqo5OWka-NBaF5w0TFS6vY8AGC8XqfYQ5y_okKBYFC8SEyl0Dkd4igyYqL5b942JqnN2Gj0Tlfe2DUxUyg6j7tExUfX93cBEJeWCl6gGqc27Xgb0pKmN6qcGmahmSuhknV802IZi0SZgR_aKdMb_MEonBwzoWFKypFwBllzF-TFdYn6WxY0npB2CsURG3ePwAv7tA0ArVJ0dLpW6C9RYUi3s354QWtv39juxLx3OtyjXNfvVkurhEfuZCEJ_AU4Gbcky3qOa6D849FMfosWJN20Xxzw-onN8uz2KqN1xwmGV7UN4vDz7BcKd8RJg8gjkXJvgtPFawYIhXFYWqSrZ96D8VMdMFAQ8L5U1QWrjZ7mfamenoA0-04LedlrJnoliRY3Ywfl78HhcSckgXBwBS64guv38-zVlDqPThsquZOLwws21WB29_hNty0RxobkEB2iav8fOSzp-Btez7n7eE0utvEwIL9E5SwUKv-EgTdAK5hNPnfzanYja6BWCc5aUGdl7NPzx1w83h_IjE8UvN5-u5tonlLWn-QIS_DSO1gWaMz9GPAMF_50dAJZd_5-_BfZ_JuahP1_BOXkPBLSM7BTe6CgCPI7PrbUgkAPbHt4E8U30zneXj2rui3S0KejGAb5pszAFj_ONuKShPp_efLq9_nD9GeopLAeSCr6Iz5w_VAMv4fbR5eVX_DSCNI5-CrzF1yuGN80-aXbJTm5wH29TnqZpnsWb076tsyQXOZdNs43rbczzXV7EybatU7ltsmaj94KLjAuRcZ7xLI6KVuW1wJzXCpVKcpZyHKTuI1oxkXXdRns_4T4WRc53m17W2Pv5bSDEebkIeia4PV14V0-dZynvtQ_-yUTQoZ8fFMuMzq7gdj32V7NptZUvBue_2MebyfX7Uwijp5oRFa1SHU5THSk7PO3OOdzR2a-o5pVJWdK2PSd6txd_BQAA__8AkrBN">