[Bug fortran/105807] ICE / error when defining a class containing polymorphic components

gscfq@t-online.de gcc-bugzilla@gcc.gnu.org
Tue Jun 21 18:48:30 GMT 2022


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

G. Steinmetz <gscfq@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gscfq@t-online.de

--- Comment #2 from G. Steinmetz <gscfq@t-online.de> ---

Some simplified versions :


$ cat z1.f90
program p
    type, abstract :: t
    end type
    type, abstract :: t2
        integer :: n
        class(t), allocatable :: v
    end type
    type, extends(t2) :: elem2d
    end type
    type, extends(t) :: vect3d
    end type
    type(vect3d) :: b
    class(t2), allocatable :: e
    e = elem2d(10,b)
end program


$ cat z2.f90
program p
    type t
    end type
    type t2
        integer :: n
        class(t), allocatable :: v
    end type
    type, extends(t2) :: elem2d
    end type
    type, extends(t) :: vect3d
    end type
    type(vect3d) :: b
    class(t2), allocatable :: e
    e = elem2d(10,b)
end program


$ gfortran-13-20220619 -c z1.f90
z1.f90:14:20:

   14 |     e = elem2d(10,b)
      |                    1
internal compiler error: in fold_convert_loc, at fold-const.cc:2593
0x9c67b3 fold_convert_loc(unsigned int, tree_node*, tree_node*)
        ../../gcc/fold-const.cc:2593
0x7eb806 gfc_trans_subcomponent_assign
        ../../gcc/fortran/trans-expr.cc:9004
0x7ec3bb gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool)
        ../../gcc/fortran/trans-expr.cc:9197
0x7ebec2 gfc_trans_subcomponent_assign
        ../../gcc/fortran/trans-expr.cc:9021
0x7ec3bb gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool)
        ../../gcc/fortran/trans-expr.cc:9197
0x7e4970 gfc_conv_structure(gfc_se*, gfc_expr*, int)
        ../../gcc/fortran/trans-expr.cc:9264
0x7e4cfc gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.cc:9432
0x7f5f91 gfc_trans_assignment_1
        ../../gcc/fortran/trans-expr.cc:11700
0x7b3b67 trans_code
        ../../gcc/fortran/trans.cc:1950
0x7dd0be gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.cc:7654
0x75f53e translate_all_program_units
        ../../gcc/fortran/parse.cc:6669
0x75f53e gfc_parse_file()
        ../../gcc/fortran/parse.cc:6956
0x7acb6f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:229


More information about the Gcc-bugs mailing list