A program compiled with gfortran terminates with a segmentation fault at an intrinsic assignment to an allocatable array component of a derived type with a kind type parameter. Please see below. I tried several workarounds, including replacing the intrinsic assignment with a type-bound defined assignment, a non-type-bound defined assignment, and a source allocation. I also tried compiling code below with gfortran 12, 13, and 14. The only workaround that eliminates the segmentation fault is switching to source allocation. The code below terminates normally with the NAG and LLVM Flang (Flang-new) compilers. % cat reproducer.f90 implicit none type foo_t(k) integer, kind :: k real(k), allocatable :: bar(:) end type type(foo_t(kind(0.))) foo foo%bar = [0.] end % gfortran reproducer.f90 % ./a.out Program received signal SIGSEGV: Segmentation fault - invalid memory reference. Backtrace for this error: #0 0x102dfad2f #1 0x102df9d83 #2 0x194afa583 #3 0x1027c7f4b zsh: segmentation fault ./a.out % gfortran --version GNU Fortran (Homebrew GCC 14.1.0_2) 14.1.0
Confirmed on latest trunk. $ gfc -g pr116468.f90 $ ./a.out Program received signal SIGSEGV: Segmentation fault - invalid memory reference. Backtrace for this error: #0 0x7f066e64fcff in ??? #1 0x401173 in MAIN__ at /home/jerry/dev/test/pr116468/pr116468.f90:10 #2 0x4011b4 in main at /home/jerry/dev/test/pr116468/pr116468.f90:11 Segmentation fault (core dumped)
(In reply to Damian Rouson from comment #0) > type foo_t(k) > integer, kind :: k > real(k), allocatable :: bar(:) > end type Unfortunately, PDTs are broken in gfortran. There are 58 open bug reports.