Skip to content

[Flang] The value of c_intmax_t defined in iso_c_binding is different for Flang and Gfortran/ifx. #128609

Closed
@ohno-fj

Description

@ohno-fj
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:

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
$ 

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions