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

            Bug ID: 122696
           Summary: [PDT] ICE when selector is a generic interface with
                    the same name as a derived type
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at archaeologic dot codes
  Target Milestone: ---

The reproducer was isolated with the pr 122693 because I think the current pr
one demonstrates a distinct issue because this issue occurs in the main
program, whereas in the case of 122693, moving the executable statements from
the function to the main program eliminates the problem demonstrated in 122693.

$ cat reproducer.f90 
module tensor_m
  implicit none

  type tensor_t(k)
    integer, kind :: k = kind(0.)
  end type

  interface tensor_t
    module function tensor()
      implicit none
      type(tensor_t) tensor
    end function
  end interface

end module

  use tensor_m
  implicit none
  associate(t => tensor_t())
  end associate
end

$ gfortran -c reproducer.f90 
reproducer.f90:19:28:

   19 |   associate(t => tensor_t())
      |                            1
internal compiler error: in gfc_get_derived_type, at
fortran/trans-types.cc:2848
0x27fa08f internal_error(char const*, ...)
        ../../trunk/gcc/diagnostic-global-context.cc:787
0xa85409 fancy_abort(char const*, int, char const*)
        ../../trunk/gcc/diagnostics/context.cc:1806
0x822791 gfc_get_derived_type(gfc_symbol*, int)
        ../../trunk/gcc/fortran/trans-types.cc:2848
0xc9b0c5 gfc_typenode_for_spec(gfc_typespec*, int)
        ../../trunk/gcc/fortran/trans-types.cc:1381
0xc9b4e0 gfc_sym_type(gfc_symbol*, bool)
        ../../trunk/gcc/fortran/trans-types.cc:2517
0xc0bddd gfc_get_symbol_decl(gfc_symbol*)
        ../../trunk/gcc/fortran/trans-decl.cc:1951
0xc0ff27 generate_local_decl
        ../../trunk/gcc/fortran/trans-decl.cc:6342
0xbb62d2 do_traverse_symtree
        ../../trunk/gcc/fortran/symbol.cc:4404
0xc056a5 generate_local_vars
        ../../trunk/gcc/fortran/trans-decl.cc:6553
0xc056a5 gfc_process_block_locals(gfc_namespace*)
        ../../trunk/gcc/fortran/trans-decl.cc:8482
0xc89429 gfc_trans_block_construct(gfc_code*)
        ../../trunk/gcc/fortran/trans-stmt.cc:2615
0xbd5927 trans_code
        ../../trunk/gcc/fortran/trans.cc:2445
0xc11402 gfc_generate_function_code(gfc_namespace*)
        ../../trunk/gcc/fortran/trans-decl.cc:8152
0xb70e9e translate_all_program_units
        ../../trunk/gcc/fortran/parse.cc:7554
0xb70e9e gfc_parse_file()
        ../../trunk/gcc/fortran/parse.cc:7876
0xbd220f gfc_be_parse_file
        ../../trunk/gcc/fortran/f95-lang.cc:247
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ gfortran --version
GNU Fortran (GCC) 16.0.0 20251114 (experimental)

Reply via email to