https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99256
--- Comment #5 from kargl at gcc dot gnu.org ---
(In reply to anlauf from comment #4)
> (In reply to anlauf from comment #3)
>
> Even simpler fix, as intrinsics do not accept alternate return specifiers:
>
> diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
> index a7ecdb401ef..4e5ec966d94 100644
> --- a/gcc/fortran/intrinsic.c
> +++ b/gcc/fortran/intrinsic.c
> @@ -4420,7 +4420,7 @@ do_sort:
> FOR_EACH_VEC_ELT (dummy_args, idx, f)
> {
> a = ordered_actual_args[idx];
> - if (a && a->label != NULL && f->ts.type)
> + if (a && a->label != NULL)
> {
> gfc_error ("ALTERNATE RETURN not permitted at %L", where);
> return false;
If this survives regression testing, it certainly seems to fall into the
obviously correct category. I think you can commit the patch.