I'm attempting to submit the code below to Bugzilla, but the site
appears to be hanging. I'll try again later. Presumably this should
be added to the deferred-length character metabug. This code executes
without error when compiled with gfortran 14.2.0, but seg faults when
compiled with a recent build of gfortran 15.
Damian
% cat all.f90
implicit none
type string_t
character(len=:), allocatable :: string_
end type
call check_allocation([foo()])
contains
type(string_t) function foo()
foo%string_ = "foo"
end function
elemental subroutine check_allocation(string)
type(string_t), intent(in) :: string
if (.not. allocated(string%string_)) error stop "unallocated"
end subroutine
end
rouson@rouson-m73 julienne % gfortran all.f90
rouson@rouson-m73 julienne % ./a.out
a.out(64876,0x1eeb90f40) malloc: *** error for object 0x600000bd8030:
pointer being freed was not allocated
a.out(64876,0x1eeb90f40) malloc: *** set a breakpoint in
malloc_error_break to debug
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0 0x1031a2b63
#1 0x1031a1ae3
#2 0x186d72583
#3 0x186d41c1f
#4 0x186c4ea2f
#5 0x186b5edc3
#6 0x186b6242f
#7 0x186b7c493
#8 0x102b33d57
#9 0x102b33e5b
zsh: abort ./a.out
rouson@rouson-m73 julienne % gfortran --version
GNU Fortran (GCC) 15.0.1 20250119 (experimental)