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

            Bug ID: 102312
           Summary: [12 Regression] ICE in gfc_get_dtype_rank_type, at
                    fortran/trans-types.c:1558
           Product: gcc
           Version: 12.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 20210530 and 20210606 :


$ cat z1.f90
program p
   print *, f(null())
contains
   integer function f(x) bind(c)
      use iso_c_binding
      integer(kind=c_int), pointer, intent(in) :: x(..)
      f = 0
   end
end


$ cat z3.f90
recursive function f(x) result(z) bind(c)
   use iso_c_binding
   integer(kind=c_int), pointer, intent(in) :: x(..)
   real :: z
   z = f(null())
end


$ gfortran-11 -c z1.f90
$
$ gfortran-12-20210905 -c z1.f90
z1.f90:2:21:

    2 |    print *, f(null())
      |                     1
internal compiler error: in gfc_get_dtype_rank_type, at
fortran/trans-types.c:1558
0x89872f gfc_get_dtype_rank_type(int, tree_node*)
        ../../gcc/fortran/trans-types.c:1558
0x83f65a gfc_conv_scalar_to_descriptor(gfc_se*, tree_node*, symbol_attribute)
        ../../gcc/fortran/trans-expr.c:126
0x849ae8 gfc_conv_gfc_desc_to_cfi_desc
        ../../gcc/fortran/trans-expr.c:5577
0x84d9a7 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*,
gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
        ../../gcc/fortran/trans-expr.c:6009
0x8445ea gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.c:9020
0x84b402 gfc_conv_expr_reference(gfc_se*, gfc_expr*, bool)
        ../../gcc/fortran/trans-expr.c:9166
0x875597 gfc_trans_transfer(gfc_code*)
        ../../gcc/fortran/trans-io.c:2582
0x816527 trans_code
        ../../gcc/fortran/trans.c:2138
0x87307e build_dt
        ../../gcc/fortran/trans-io.c:2026
0x816507 trans_code
        ../../gcc/fortran/trans.c:2110
0x83cb64 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6918
0x7c2ee6 translate_all_program_units
        ../../gcc/fortran/parse.c:6569
0x7c2ee6 gfc_parse_file()
        ../../gcc/fortran/parse.c:6838
0x80f57f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

Reply via email to