Found while looking again as PR 39304. The following program causes an ICE. It might well be only fixable with the new array descriptor. The program works with 4.1 and 4.2 (which might well be only by chance) but fails with 4.3/4.4/4.5 with: test.f90: In function 'func': test.f90:7:0: internal compiler error: Segmentation fault Program received signal SIGSEGV, Segmentation fault. 0x000000000055d935 in gfc_trans_pointer_assignment (expr1=0x137b4e0, expr2=0x137b970) at /home/tob/projects/gcc/gcc/fortran/trans-expr.c:4676 4676 gfc_add_modify (&lse.post, GFC_DECL_SPAN(decl), tmp); module m implicit none type t real :: a(3) end type t contains function func(x,i) type(t), target :: x(:) integer :: i real, dimension(:), pointer :: func func => x%a(i) end function func end module m use m type(t) :: mt(3) real :: res(3) mt = t(1.0) res = matmul(func(mt,1), reshape( (/1,2,3,4,5,6,7,8,9/), (/3,3 /) )) if (res(1) /= 6.0 .and. res(2) /= 15.0 .and. res(3) /= 24.0) then print *, res stop 'error' end if end
Might as well confirm this one.
Reduced testcase: type t real :: a(3) end type t contains function func(x) type(t), target :: x(:) real, dimension(:), pointer :: func func => x%a(1) end function func end
Roughly the same testcase, same backtrace. *** This bug has been marked as a duplicate of 34640 ***