https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111265
Bug ID: 111265 Summary: Compiler segfault with character array in deferred type, when returned by a function Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: mailling-lists-bd at posteo dot de Target Milestone: --- Hi, the following code is giving a compiler segfault with Gfortran 13.2.1 on Fedora, when compiled with `gfortran -c test.f90`. ``` test.f90 module mod_abs_type implicit none type, abstract :: my_abs_type_t private character(len=1024), allocatable :: str_(:) contains private procedure, public :: str end type my_abs_type_t contains pure function str(self) result(res) class(my_abs_type_t), intent(in) :: self character(len=1024), allocatable :: res(:) allocate(res(size(self%str_))) res(:) = self%str_(:) end function str end module mod_abs_type module mod_container use mod_abs_type, only: my_abs_type_t implicit none type :: my_container_t private class(my_abs_type_t), allocatable :: ele contains private procedure, public :: str end type my_container_t contains pure function str(self) result(res) class(my_container_t), intent(in) :: self character(len=1024), allocatable :: res(:) res = self%ele%str() end function str end module mod_container ``` The error message is: 42 | res = self%ele%str() | 1 internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source. See <http://bugzilla.redhat.com/bugzilla> for instructions. Thanks !