https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119136
--- Comment #25 from Steve Kargl <kargl at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #24)
> (In reply to Jakub Jelinek from comment #23)
>
> Jakub, if I understand you correctly, then this can be done as part
> of the lock if the support is there, but that is not guaranteed
> for all systems that gfortran runs on. Hmm... how do we want to
> do this?
I had a short email exchange with Jerry off-line. Another
possibility would be to disable the recursive IO check if
one uses -fopenmp or -fopenacc. This would require adding
a component to libgfortran(compile_options_t) and passing
it to libgfortran. In pseudocode,
/* Check if this is a parent I/O. */
if (p->child_dtio == 0 && !compile_options.fopenmp)
{
if (TRYLOCK(&p->lock))
{
generate_error (&dtp->common, ... );
return;
}
UNLOCK(&p->lock);
}