[Bug fortran/102241] New: ICE when declaring derived type with a parameterized derived type member

roland_wirth at web dot de gcc-bugzilla@gcc.gnu.org
Wed Sep 8 15:21:47 GMT 2021


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

            Bug ID: 102241
           Summary: ICE when declaring derived type with a parameterized
                    derived type member
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roland_wirth at web dot de
  Target Milestone: ---

The following code triggers an ICE in gfortran 9.1.0

    MODULE mo
      TYPE t1(n)
        INTEGER, LEN :: n
        INTEGER :: a(n)
      END TYPE

      TYPE t2
        TYPE(t1(1)) :: p_t1
      END TYPE
    END MODULE

f951: internal compiler error: in gfc_get_derived_type, at
fortran/trans-types.c:2519
0x586d70 gfc_get_derived_type(gfc_symbol*, int)
        ../.././gcc/fortran/trans-types.c:2519
0x715384 gfc_get_derived_type(gfc_symbol*, int)
        ../.././gcc/fortran/trans-types.c:2670
0x715cd8 gfc_typenode_for_spec(gfc_typespec*, int)
        ../.././gcc/fortran/trans-types.c:1166
0x71601c gfc_sym_type(gfc_symbol*)
        ../.././gcc/fortran/trans-types.c:2247
0x71601c gfc_sym_type(gfc_symbol*)
        ../.././gcc/fortran/trans-types.c:2205
0x6bf0a2 gfc_get_symbol_decl(gfc_symbol*)
        ../.././gcc/fortran/trans-decl.c:1718
0x6c2178 gfc_create_module_variable
        ../.././gcc/fortran/trans-decl.c:5140
0x6c2178 gfc_create_module_variable
        ../.././gcc/fortran/trans-decl.c:5057
0x684912 do_traverse_symtree
        ../.././gcc/fortran/symbol.c:4166
0x6c2943 gfc_generate_module_vars(gfc_namespace*)
        ../.././gcc/fortran/trans-decl.c:5639
0x69f589 gfc_generate_module_code(gfc_namespace*)
        ../.././gcc/fortran/trans.c:2193
0x650285 translate_all_program_units
        ../.././gcc/fortran/parse.c:6121
0x650285 gfc_parse_file()
        ../.././gcc/fortran/parse.c:6337
0x6990ef gfc_be_parse_file
        ../.././gcc/fortran/f95-lang.c:204
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

The error persists when adding the POINTER attribute to p_t1 and when deferring
the type parameter (TYPE(t1(:))). Also for the invalid declaration with
deferred parameter, but without POINTER.


More information about the Gcc-bugs mailing list