https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102368

            Bug ID: 102368
           Summary: Failure to compile program using the C_SIZEOF function
                    in ISO_C_BINDING
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: longb at cray dot com
  Target Milestone: ---

> cat test.f90
program main
use,intrinsic ::  iso_c_binding
implicit none

character(kind=c_char, len=*), parameter :: blergh = 'abc'

print *, c_sizeof(blergh)
print *, c_sizeof(.true.)
print *, c_sizeof(5)
print *, c_sizeof(5.0)
print *, c_sizeof(5.0d0)
end program main

> gfortran test.f90
test.f90:7:18:

    7 | print *, c_sizeof(blergh)
      |                  1
Error: 'x' argument of 'c_sizeof' intrinsic at (1) must be an interoperable
data entity: Type shall have a character length of 1

> ifort test.f90
> ./a.out
                     3
                     4
                     4
                     4
                     8

gfortran appears to be using pre-F08 rules for C_SIZEOF.

Reply via email to