https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121429
--- Comment #6 from Andre Vehreschild <vehre at gcc dot gnu.org> ---
Well, I suppose something like:
diff --git a/libgfortran/caf/shmem.c b/libgfortran/caf/shmem.c
index 446e5f54483..24400672336 100644
--- a/libgfortran/caf/shmem.c
+++ b/libgfortran/caf/shmem.c
@@ -463,6 +463,7 @@ _gfortran_caf_deregister (caf_token_t *token,
caf_deregister_t type, int *stat,
free (ca);
free (TOKEN (*token));
*token = NULL;
+ sync_team (caf_current_team);
}
else
{
should do the trick.