https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90786
Bug ID: 90786
Summary: ICE on procedure pointer assignment to function with
class pointer result
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: abensonca at gmail dot com
Target Milestone: ---
The following causes an ICE on trunk:
module f
procedure(c), pointer :: c_
type :: s
end type s
contains
function c()
implicit none
class(s), pointer :: c
c => null()
return
end function c
subroutine fs()
implicit none
c_ => c
return
end subroutine fs
end module f
$ gfortran -c tmp.F90 -o tmp.o
tmp.F90:18:0:
18 | c_ => c
|
internal compiler error: tree check: expected record_type or union_type or
qual_union_type, have function_type in gfc_class_data_get, at
fortran/trans-expr.c:191
0x71c0f0 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc-trunk/gcc/tree.c:9900
0x5d791d tree_check3(tree_node*, char const*, int, char const*, tree_code,
tree_code, tree_code)
../../gcc-trunk/gcc/tree.h:3220
0x5d791d gfc_class_data_get(tree_node*)
../../gcc-trunk/gcc/fortran/trans-expr.c:191
0x8feec1 gfc_trans_pointer_assignment(gfc_expr*, gfc_expr*)
../../gcc-trunk/gcc/fortran/trans-expr.c:8898
0x8b70d2 trans_code
../../gcc-trunk/gcc/fortran/trans.c:1833
0x8e393b gfc_generate_function_code(gfc_namespace*)
../../gcc-trunk/gcc/fortran/trans-decl.c:6655
0x8bb4a1 gfc_generate_module_code(gfc_namespace*)
../../gcc-trunk/gcc/fortran/trans.c:2219
0x86b095 translate_all_program_units
../../gcc-trunk/gcc/fortran/parse.c:6121
0x86b095 gfc_parse_file()
../../gcc-trunk/gcc/fortran/parse.c:6337
0x8b43ef gfc_be_parse_file
../../gcc-trunk/gcc/fortran/f95-lang.c:204
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/home/abenson/Galacticus/Tools
--enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 10.0.0 20190501 (experimental) (GCC)
Possibly related to PR86242?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86242