[Flang] Incorrect value of C_INT_FAST*_T
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
## Summary
The values of `C_INT_FAST16_T` and `C_INT_FAST32_T` are inconsistent with the companion processor (i.e., Clang). This issue may be related to #58282.
### Reproducer
* test.f90
```fortran
use iso_c_binding
integer(c_int_fast16_t) :: i1
integer(c_int_fast32_t) :: i2
print *,'c_int_fast16_t=',c_sizeof(i1)
print *,'c_int_fast32_t=',c_sizeof(i2)
end
```
* test.c
```c
#include
#include
int main(void) {
printf("sizeof(int_fast16_t)=%zu\n", sizeof(int_fast16_t));
printf("sizeof(int_fast32_t)=%zu\n", sizeof(int_fast32_t));
return 0;
}
```
* commands
```console
$ flang --version
flang version 23.0.0git (https://github.com/llvm/llvm-project.git ecdd6403fd213f90243a3d354d4db3483b89471f)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /path/to/llvm/build/bin
Build config: +assertions
$ flang test.f90 && ./a.out
c_int_fast16_t= 2
c_int_fast32_t= 4
$ clang test.c && ./a.out
sizeof(int_fast16_t)=8
sizeof(int_fast32_t)=8
```
## Other Compilers
* GFortran
```console
$ gfortran --version
GNU Fortran (GCC) 15.2.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gfortran test.f90 && ./a.out
c_int_fast16_t= 8
c_int_fast32_t= 8
$ gcc test.c && ./a.out
sizeof(int_fast16_t)=8
sizeof(int_fast32_t)=8
```
* Intel Fortran
```console
$ ifx --version
ifx (IFX) 2025.3.2 20260112
Copyright (C) 1985-2026 Intel Corporation. All rights reserved.
$ ifx -O0 test.f90 && ./a.out
c_int_fast16_t= 8
c_int_fast32_t= 8
$ icx -O0 test.c && ./a.out
sizeof(int_fast16_t)=8
sizeof(int_fast32_t)=8
```
Contributor guide
Research direction
Start with the test.f90 reproducer and compare its c_sizeof results with test.c compiled by clang on the shown AArch64 target. Trace Flang's iso_c_binding handling for C_INT_FAST16_T and C_INT_FAST32_T. Done means the Flang sizes match the companion C compiler, with regression coverage for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100