The code works as expected in 9.3.1 20200614. In 10.3.1 20220107 and trunk it gives Program received signal SIGSEGV: Segmentation fault - invalid memory reference. program tester character(LEN=:), allocatable :: S S = 'CMB' call TT(trim(S)) contains subroutine TT(S) class(*), intent(in) :: S class(*), allocatable :: S2 allocate(S2, source=S) end subroutine TT end program tester
Also broken in 9.4.1 20220107.
Started with r11-6928-g4225af228b5d52e8 and was fixed on master with r12-1005-gfe03f4fc9548b3fd.
(In reply to Martin Liška from comment #2) > Started with r11-6928-g4225af228b5d52e8 and was fixed on master with > r12-1005-gfe03f4fc9548b3fd. Backporting r12-1005 (see pr100551) fixes the segfault in comment#0 also for 10-branch.
Fixed on 10-branch with r10-10384. Cherrypicking that patch however does not fix the issue on 9-branch. There must be something else missing which would need backporting.
After the backport this should have been marked as 9-regression. Doing so now.
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
Fixed for gcc-10.4.