https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122524
Bug ID: 122524
Summary: [PDT] ICE on associate-name actual argument to
user-defined structure constructor
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: ---
This involves some of the same code as pr122501 but with a different reduced
and different compiler error:
$ cat reproducer.f90
module tensor_map_m
implicit none
type tensor_t(k)
integer, kind :: k = kind(1.)
real(k), allocatable :: values_(:)
end type
interface tensor_t
module function tensor(values)
implicit none
double precision values(:)
type(tensor_t(kind(0D0))) tensor
end function
end interface
type tensor_map_t(k)
integer, kind :: k = kind(1.)
real(k) slope_
end type
contains
function unnormalized_tensor(self, tensor)
type(tensor_map_t(kind(0D0))) self
type(tensor_t(kind(0D0))) tensor, unnormalized_tensor
associate(unnormalized_values => tensor%values_*self%slope_)
unnormalized_tensor = tensor_t(unnormalized_values)
end associate
end function
end module
$ gfortran -c reproducer.f90
reproducer.f90:27:57:
27 | unnormalized_tensor = tensor_t(unnormalized_values)
| 1
internal compiler error: in fold_convert_loc, at fold-const.cc:2793
0x262b66b 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
0xb94eac gfc_trans_scalar_assign(gfc_se*, gfc_se*, gfc_typespec, bool, bool,
bool, bool)
../../trunk/gcc/fortran/trans-expr.cc:11703
0xbb0354 gfc_trans_assignment_1
../../trunk/gcc/fortran/trans-expr.cc:13420
0xb529f7 trans_code
../../trunk/gcc/fortran/trans.cc:2349
0xc01dc3 gfc_trans_block_construct(gfc_code*)
../../trunk/gcc/fortran/trans-stmt.cc:2624
0xb52ab7 trans_code
../../trunk/gcc/fortran/trans.cc:2445
0xb8c1c1 gfc_generate_function_code(gfc_namespace*)
../../trunk/gcc/fortran/trans-decl.cc:8132
0xb582b1 gfc_generate_module_code(gfc_namespace*)
../../trunk/gcc/fortran/trans.cc:2776
0xaf2355 translate_all_program_units
../../trunk/gcc/fortran/parse.cc:7515
0xaf2355 gfc_parse_file()
../../trunk/gcc/fortran/parse.cc:7848
0xb4f403 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 20251101 (experimental)