https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87980
--- Comment #8 from Jürgen Reuter <juergen.reuter at desy dot de> --- The actual workaround that I'm using (the code is from of our stale branches which recently became active again) is: [...] subroutine qn_string_set (qns, col) class(qn_string_t), intent(inout) :: qns class(col_t), dimension(:), intent(in), optional :: col class(col_t), allocatable :: col0 integer :: i do i = 1, qns%length if (present (col)) then col0 = col(i) call qns%qn(i)%set (col=col0) end if end do end subroutine qn_string_set end module quantum_numbers [...] This seems to work in our code, i.e. it compiles and it does what it should. But in the long run, would be great to get it fixed for gcc/gfortran 12.