https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117901
--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> --- (In reply to Paul Thomas from comment #4) ...snip... > I will now clean up the patch and produce a suitably reduced testcase that > isolates the problem. > > Paul This was my attempt at a testcase, which is more fundamentally broken than class_transformational_1.f90: class(*), allocatable :: x(:,:) x = reshape ([1,2,3,4], [2,2]) call foo (foobar(x)) ! Segfault here - _data component of 'foobar' result passed! contains function foobar(arg2) result(res) class(*), contiguous, target :: arg2(:,:) class(*), pointer :: res(:) res(1:size(arg2)) => arg2(:,:) ! select type (res) ! With this uncommented, gives "STOP 1" ! type is (integer) ! Otherwise a segfault at entry to 'foo' ! print *, res ! end select end subroutine foo(arg1) class(*) :: arg1(:) call bar(arg1) end subroutine bar(arg) class(*) :: arg(..) select rank (arg) rank (1) select type (arg) type is (integer) print *, arg class default stop 1 end select rank default stop 2 end select end end Other brands give the expected result. Paul