Issue 208361
Summary [Flang] Incorrect value of C_INT_FAST*_T
Labels flang
Assignees
Reporter yus3710-fj
    ## 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 <stdio.h>
#include <stdint.h>
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
  ```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to