https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122578
--- Comment #6 from Damian Rouson <damian at archaeologic dot codes> ---
Paul, as requested, below is the minimal reproducer for learn-addition.F90.
Interestingly, the code below compiles cleanly if the "only" clause is removed.
$ cat reproducer.f90
module tensor_m
implicit none
type tensor_t(k)
integer, kind :: k = kind(0.)
real(k), allocatable :: value_
end type
contains
function y(x)
type(tensor_t) x, y
y = tensor_t(x%value_)
end function
end module
use tensor_m, only : tensor_t, y
implicit none
type(tensor_t) desired_output
desired_output = y(tensor_t(0.))
end
$ gfortran -c reproducer.f90
reproducer.f90:19:34:
19 | desired_output = y(tensor_t(0.))
| 1
internal compiler error: in fold_convert_loc, at fold-const.cc:2793
0x27f880f internal_error(char const*, ...)
../../trunk/gcc/diagnostic-global-context.cc:787
0xa851ef fancy_abort(char const*, int, char const*)
../../trunk/gcc/diagnostics/context.cc:1806
0x8610b8 fold_convert_loc(unsigned long, tree_node*, tree_node*)
../../trunk/gcc/fold-const.cc:2793
0xc1a3b5 gfc_trans_scalar_assign(gfc_se*, gfc_se*, gfc_typespec, bool, bool,
bool, bool)
../../trunk/gcc/fortran/trans-expr.cc:11703
0xc37425 gfc_trans_assignment_1
../../trunk/gcc/fortran/trans-expr.cc:13428
0xbd54a7 trans_code
../../trunk/gcc/fortran/trans.cc:2349
0xc11042 gfc_generate_function_code(gfc_namespace*)
../../trunk/gcc/fortran/trans-decl.cc:8152
0xb70ade translate_all_program_units
../../trunk/gcc/fortran/parse.cc:7554
0xb70ade gfc_parse_file()
../../trunk/gcc/fortran/parse.cc:7876
0xbd1e4f 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 20251111 (experimental)