[Bug fortran/84885] New: c_char bind length

mdblack98 at yahoo dot com gcc-bugzilla@gcc.gnu.org
Thu Mar 15 15:56:00 GMT 2018


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

            Bug ID: 84885
           Summary: c_char bind length
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mdblack98 at yahoo dot com
  Target Milestone: ---

subroutine foo(i,c)
  use, intrinsic :: iso_c_binding, only: c_char
        integer i

  type, bind(C) :: params_block
        character(kind=c_char,len=10) :: c
  end type params_block
        write(*,*) 'X',c,'Z'
end

This program fails to compile with gcc 8.0.1 20180304 -- but only if the
character declaration is inside a type block
Compiles fine with pre 8.0 compilers

gfortran -fPIC -g -c foo.f90
foo.f90:6:42:

         character(kind=c_char,len=10) :: c
                                          1
Error: Component 'c' of BIND(C) type at (1) must have length one

Mike


More information about the Gcc-bugs mailing list