[Bug fortran/69867] ICE on initializing character in type with array of incompatible data

gerhard.steinmetz.fortran@t-online.de gcc-bugzilla@gcc.gnu.org
Thu Feb 18 19:29:00 GMT 2016


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

--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Detected when lhs is a scalar :

$ cat z4.f90
program p
   type t
      character(1) :: c(1) = 1
   end type
end

$ gfortran-6 z4.f90
z4.f90:3:28:

       character(1) :: c(1) = 1
                            1
Error: Can't convert INTEGER(4) to CHARACTER(1) at (1)



And detected outside of a type, e.g. :

$ cat z5.f90
program p
   character(1) :: b = [1]
   character(1) :: c(1) = [1]
end

$ gfortran-6 z5.f90
z5.f90:2:20:

    character(1) :: b = [1]
                    1
Error: Incompatible ranks 0 and 1 in assignment at (1)
z5.f90:3:25:

    character(1) :: c(1) = [1]
                         1
Error: Can't convert INTEGER(4) to CHARACTER(1) at (1)


More information about the Gcc-bugs mailing list