Bug ID: 79072
           Summary: ICE with class(*) pointer function result and
                    character value
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot
          Reporter: neil.n.carlson at gmail dot com
  Target Milestone: ---

This example gives an ICE with the current 7.0 trunk and all 6.x releases:

function foo()
  class(*), pointer :: foo
  character(3), target :: string = 'foo'
  foo => string
  select type (foo)
  type is (character(*))
    !print *, foo
  end select
end function

The ICE disappears if either:
1) type is (character(*)) is replaced with integer, for example;
2) the return variable is specified in a result(...) clause.

In the original code that exhibited the compiler bug, the function
returns correct values except for character values, so I expect the
underlying problem involves the unlimited polymorphic pointer
assignment statement and character dynamic types.  I introduced
the select type (which produced the ICE) when debugging. 

Here's the output from the compiler:

$ gfortran -c code.f90 

 function foo()

internal compiler error: tree check: expected record_type or union_type or
qual_union_type, have function_type in gfc_class_len_get, at
0xe75f1c tree_check_failed(tree_node const*, char const*, int, char const*,
0x6f03c5 tree_check3(tree_node*, char const*, int, char const*, tree_code,
tree_code, tree_code)
0x6f03c5 gfc_class_len_get(tree_node*)
0x745cbc trans_associate_var
0x745cbc gfc_trans_block_construct(gfc_code*)
0x6ba467 trans_code
0x747c1e gfc_trans_select_type_cases
0x747c1e gfc_trans_select_type(gfc_code*)
0x6ba3d7 trans_code
0x745638 gfc_trans_block_construct(gfc_code*)
0x6ba467 trans_code
0x6eb598 gfc_generate_function_code(gfc_namespace*)
0x672f76 translate_all_program_units
0x672f76 gfc_parse_file()
0x6b6512 gfc_be_parse_file
Please submit a full bug report,

Reply via email to