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

--- Comment #4 from Damian Rouson <damian at archaeologic dot codes> ---
The issue below is what I observe with the most recent patch applied:

$ cat reproducer.f90 
module tensor_m
  implicit none

  type tensor_t(k)
    integer, kind :: k = kind(1.)
    real(k), allocatable :: values_
  end type

  type tensor_map_t(k)
    integer, kind :: k = kind(1.)
    real(k), allocatable :: intercept_
  end type

contains
    module function unnormalized_tensor(self)
      type(tensor_map_t(kind(0D0))) self
      type(tensor_t(kind(0D0))) unnormalized_tensor
      unnormalized_tensor = tensor_t(self%intercept_)
    end function
end module

$ gfortran -c reproducer.f90 
reproducer.f90:18:53:

   18 |       unnormalized_tensor = tensor_t(self%intercept_)
      |                                                     1
internal compiler error: in fold_convert_loc, at fold-const.cc:2793
0x262b91b internal_error(char const*, ...)
        ../../trunk/gcc/diagnostic-global-context.cc:787
0xa0c838 fancy_abort(char const*, int, char const*)
        ../../trunk/gcc/diagnostics/context.cc:1806
0x819f7b fold_convert_loc(unsigned long, tree_node*, tree_node*)
        ../../trunk/gcc/fold-const.cc:2793
0xb94fbc gfc_trans_scalar_assign(gfc_se*, gfc_se*, gfc_typespec, bool, bool,
bool, bool)
        ../../trunk/gcc/fortran/trans-expr.cc:11703
0xbb0464 gfc_trans_assignment_1
        ../../trunk/gcc/fortran/trans-expr.cc:13420
0xb52b07 trans_code
        ../../trunk/gcc/fortran/trans.cc:2349
0xb8c2d1 gfc_generate_function_code(gfc_namespace*)
        ../../trunk/gcc/fortran/trans-decl.cc:8132
0xb583c1 gfc_generate_module_code(gfc_namespace*)
        ../../trunk/gcc/fortran/trans.cc:2776
0xaf2405 translate_all_program_units
        ../../trunk/gcc/fortran/parse.cc:7515
0xaf2405 gfc_parse_file()
        ../../trunk/gcc/fortran/parse.cc:7848
0xb4f513 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 20251102 (experimental)

Reply via email to