https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83980
Bug ID: 83980 Summary: Various issues with character length in array constructors Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: anlauf at gmx dot de Target Milestone: --- Not sure if this one is tracked elsewhere. I started to look closer after the obvious and necessary fix for pr83874 went in. program gfcbug147 implicit none type t_obstyp character(len=8) :: name end type t_obstyp type (t_obstyp) ,parameter :: obstyp(2)= & [ t_obstyp ('TEMP' ), & t_obstyp ('RADAR' ) ] character(len=8), parameter :: s1(*) = obstyp% name ! OK character(len=*), parameter :: s2(2) = obstyp% name ! Error or ICE character(len=*), parameter :: s3(*) = obstyp% name ! Error or ICE end program gfcbug147 With 8.0 trunk rev. 256935 I get the following errors for the indicated lines: gfcbug147.f90:8:17: t_obstyp ('RADAR' ) ] 1 Error: Different CHARACTER lengths (4/5) in array constructor at (1) gfcbug147.f90:8:17: t_obstyp ('RADAR' ) ] 1 Error: Different CHARACTER lengths (4/5) in array constructor at (1) Same for 5.0 and earlier. With 6.0 and 7.2.0 I get ICEs. E.g. % gfc-7 gfcbug147.f90 f951: internal compiler error: Segmentation fault 0x879abb0 crash_signal ../../gcc-7.2.0/gcc/toplev.c:337 0x8287d29 add_init_expr_to_sym ../../gcc-7.2.0/gcc/fortran/decl.c:1678 0x82914d1 variable_decl ../../gcc-7.2.0/gcc/fortran/decl.c:2432 0x82914d1 gfc_match_data_decl() ../../gcc-7.2.0/gcc/fortran/decl.c:4888 0x82ef131 match_word ../../gcc-7.2.0/gcc/fortran/parse.c:65 0x82ef131 match_word ../../gcc-7.2.0/gcc/fortran/parse.c:54 0x82f1c81 decode_statement ../../gcc-7.2.0/gcc/fortran/parse.c:376 0x82f1c81 decode_statement ../../gcc-7.2.0/gcc/fortran/parse.c:295 0x82f344c next_free ../../gcc-7.2.0/gcc/fortran/parse.c:1223 0x82f344c next_statement ../../gcc-7.2.0/gcc/fortran/parse.c:1455 0x82f4c9f parse_spec ../../gcc-7.2.0/gcc/fortran/parse.c:3829 0x82f6cb3 parse_progunit ../../gcc-7.2.0/gcc/fortran/parse.c:5632 0x82f7fbb gfc_parse_file() ../../gcc-7.2.0/gcc/fortran/parse.c:6160 0x833ce33 gfc_be_parse_file ../../gcc-7.2.0/gcc/fortran/f95-lang.c:204