https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117797
Bug ID: 117797
Summary: [15 Regression] ICE in gfc_get_array_span
Product: gcc
Version: 14.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: neil.n.carlson at gmail dot com
Target Milestone: ---
The following example trips a recent regression. It segfaults with 13.3.1,
14.2.1, and 15, but not with 13.3.0 or 14.2.0.
module foo
type, public :: any_matrix
private
class(*), allocatable :: value(:,:)
end type
contains
function bar(this) result(uptr)
class(any_matrix), target, intent(in) :: this
class(*), pointer :: uptr(:,:)
uptr => this%value
end function
end module
Here's the traceback:
$ gfortran -c gfortran-20241126.f90
gfortran-20241126.f90:13:22:
13 | uptr => this%value
| 1
internal compiler error: Segmentation fault
0x26ac91e internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:517
0x115cb76 crash_signal
../../gcc/toplev.cc:322
0xacc686 gfc_get_array_span(tree_node*, gfc_expr*)
../../gcc/fortran/trans-array.cc:998
0xadb80e gfc_conv_expr_descriptor(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-array.cc:8097
0xb1be25 gfc_trans_pointer_assignment(gfc_expr*, gfc_expr*)
../../gcc/fortran/trans-expr.cc:10801
0xac3837 trans_code
../../gcc/fortran/trans.cc:2336
0xafb4b0 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.cc:7961
0xac8ef1 gfc_generate_module_code(gfc_namespace*)
../../gcc/fortran/trans.cc:2753
0xa65fb5 translate_all_program_units
../../gcc/fortran/parse.cc:7164
0xa65fb5 gfc_parse_file()
../../gcc/fortran/parse.cc:7494
0xac034f gfc_be_parse_file
../../gcc/fortran/f95-lang.cc:241