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

            Bug ID: 99124
           Summary: [9/10/11 Regression] ICE in gfc_get_class_from_expr,
                    at fortran/trans-expr.c:541
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gs...@t-online.de
  Target Milestone: ---

Changed between 20201213 and 20210110 :
(compiles with x=x+y and x=y+z, respectivly)
(but not sure if valid at all)


$ cat z1.f90
module m
   type t
   contains
      procedure :: f
      generic :: operator(+) => f
   end type
contains
   elemental function f(a, b) result(c)
      class(t), intent(in) :: a, b
      class(t), allocatable :: c
   end
end
program p
   use m
   class(t), allocatable :: x(:), y(:)
   x = x(2) + y
end


$ cat z2.f90
module m
   type t
   contains
      procedure :: f
      generic :: operator(+) => f
   end type
contains
   elemental function f(a, b) result(c)
      class(t), intent(in) :: a, b
      class(t), allocatable :: c
   end
end
program p
   use m
   class(t), allocatable :: x(:), y(:), z
   z = x(1)
   x = z + y
end



$ gfortran-11-20201213 -c z1.f90
$
$ gfortran-11-20210214 -c z1.f90
z1.f90:16:15:

   16 |    x = x(2) + y
      |               1
internal compiler error: Segmentation fault
0xc09bcf crash_signal
        ../../gcc/toplev.c:327
0x763649 gfc_get_class_from_expr(tree_node*)
        ../../gcc/fortran/trans-expr.c:541
0x73d6a4 get_class_info_from_ss
        ../../gcc/fortran/trans-array.c:1171
0x73d6a4 gfc_trans_create_temp_array(stmtblock_t*, stmtblock_t*, gfc_ss*,
tree_node*, tree_node*, bool, bool, bool, locus*)
        ../../gcc/fortran/trans-array.c:1313
0x7483d2 gfc_conv_loop_setup(gfc_loopinfo*, locus*)
        ../../gcc/fortran/trans-array.c:5339
0x77778d gfc_trans_assignment_1
        ../../gcc/fortran/trans-expr.c:11128
0x739de7 trans_code
        ../../gcc/fortran/trans.c:1922
0x760554 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6880
0x6e6e86 translate_all_program_units
        ../../gcc/fortran/parse.c:6351
0x6e6e86 gfc_parse_file()
        ../../gcc/fortran/parse.c:6620
0x7330ff gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

Reply via email to