https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99307
Dominique d'Humieres <dominiq at lps dot ens.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-02-27 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- Also seen on Darwin; the runtime error is a.out(22702,0x10db51e00) malloc: Incorrect checksum for freed object 0x7ff344406fc0: probably modified after being freed. Corrupt value: 0x41f0000000000007 a.out(22702,0x10db51e00) malloc: *** set a breakpoint in malloc_error_break to debug Program received signal SIGABRT: Process abort signal. Reduced test module m implicit none type :: t1 integer :: i CONTAINS end type type, extends(t1) :: t2 real :: r end type interface operator(+) module procedure add_t1 end interface contains function add_t1 (a, b) result (c) class(t1), intent(in) :: a(:), b(:) class(t1), allocatable :: c(:) allocate (c, source = a) c%i = a%i + b%i select type (c) type is (t2) select type (b) type is (t2) c%r = c%r + b%r end select end select end function add_t1 end module m subroutine test_t1 use m implicit none class(t1), dimension(:), allocatable :: x, y x = [t2(1,10.0),t2(2,20.0),t2(3,30.0)] y = x x = realloc_t1 (y) x = realloc_t1 (x) x = x(3:1:-1) + y x = [t2(1,10.0),t2(2,20.0),t2(3,30.0)] contains function realloc_t1 (arg) result (res) class(t1), dimension(:), allocatable :: arg class(t1), dimension(:), allocatable :: res select type (arg) type is (t2) allocate (res, source = [t1 (arg(3)%i), t1 (arg(2)%i), t1 (arg(1)%i)]) type is (t1) allocate (res, source = [t1 (arg(2)%i), t1 (arg(1)%i), t1 (arg(3)%i)]) end select end function realloc_t1 end subroutine test_t1 call test_t1 end