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

            Bug ID: 89266
           Summary: ICE with TRANSFER of len=0 character array constructor
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

$ cat tst3.f90 
program test
  implicit none
  integer :: i
  character(*), parameter :: y = ''
  character(*), parameter     :: z = transfer ([''], y)
end

$ gfortran tst3.f90 
f951: interner Compiler-Fehler: Speicherzugriffsfehler
0xe24dff crash_signal
        ../../trunk/gcc/toplev.c:326
0x843411 add_init_expr_to_sym
        ../../trunk/gcc/fortran/decl.c:1924
0x84c5dd variable_decl
        ../../trunk/gcc/fortran/decl.c:2864
0x84c5dd gfc_match_data_decl()
        ../../trunk/gcc/fortran/decl.c:6005
0x8aac50 match_word
        ../../trunk/gcc/fortran/parse.c:65
0x8aac50 decode_statement
        ../../trunk/gcc/fortran/parse.c:376
0x8ae6f4 next_free
        ../../trunk/gcc/fortran/parse.c:1241
0x8ae6f4 next_statement
        ../../trunk/gcc/fortran/parse.c:1473
0x8afd5a parse_spec
        ../../trunk/gcc/fortran/parse.c:3865
0x8b257c parse_progunit
        ../../trunk/gcc/fortran/parse.c:5680
0x8b3923 gfc_parse_file()
        ../../trunk/gcc/fortran/parse.c:6220
0x8fd0af gfc_be_parse_file
        ../../trunk/gcc/fortran/f95-lang.c:204

Variant:

$ cat tst3.f90 
program test
  implicit none
  integer :: i
  character(*), parameter :: y = 'efcdab'
  character(6), save      :: z = transfer ([''], y)
  print *,len(z)
end
$ gfortran tst3.f90 
tst3.f90:1:0:

    1 | program test
      | 
interner Compiler-Fehler: in gfc_conv_string_init, bei
fortran/trans-const.c:147
0x6181c5 gfc_conv_string_init(tree_node*, gfc_expr*)
        ../../trunk/gcc/fortran/trans-const.c:147
0x9412f0 gfc_conv_initializer(gfc_expr*, gfc_typespec*, tree_node*, bool, bool,
bool)
        ../../trunk/gcc/fortran/trans-expr.c:7351
0x928389 gfc_get_symbol_decl(gfc_symbol*)
        ../../trunk/gcc/fortran/trans-decl.c:1831
0x92aee7 generate_local_decl
        ../../trunk/gcc/fortran/trans-decl.c:5621
0x8e8622 do_traverse_symtree
        ../../trunk/gcc/fortran/symbol.c:4155
0x92c074 generate_local_vars
        ../../trunk/gcc/fortran/trans-decl.c:5821
0x92c074 gfc_generate_function_code(gfc_namespace*)
        ../../trunk/gcc/fortran/trans-decl.c:6465
0x8b3f0e translate_all_program_units
        ../../trunk/gcc/fortran/parse.c:6134
0x8b3f0e gfc_parse_file()
        ../../trunk/gcc/fortran/parse.c:6337
0x8fd0af gfc_be_parse_file
        ../../trunk/gcc/fortran/f95-lang.c:204

Reply via email to